Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[F] rel nofollow links #8106

Merged
merged 5 commits into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui/control/attribution_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class AttributionControl {
return acc;
}, `?`);
editLink.href = `${config.FEEDBACK_URL}/${paramString}${this._map._hash ? this._map._hash.getHashString(true) : ''}`;
editLink.rel = "noopener";
editLink.rel = "noopener nofollow";
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ui/control/logo_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class LogoControl {
this._container = DOM.create('div', 'mapboxgl-ctrl');
const anchor = DOM.create('a', 'mapboxgl-ctrl-logo');
anchor.target = "_blank";
anchor.rel = "noopener";
anchor.rel = "noopener nofollow";
anchor.href = "https://www.mapbox.com/";
anchor.setAttribute("aria-label", "Mapbox logo");
anchor.setAttribute("rel", "noopener");
anchor.setAttribute("rel", "noopener nofollow");
this._container.appendChild(anchor);
this._container.style.display = 'none';

Expand Down
1 change: 1 addition & 0 deletions test/unit/ui/control/attribution.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ test('AttributionControl has the correct edit map link', (t) => {
map.addLayer({ id: '1', type: 'fill', source: '1' });
map.on('data', (e) => {
if (e.dataType === 'source' && e.sourceDataType === 'metadata') {
t.equal(attribution._editLink.rel, 'noopener nofollow');
t.equal(attribution._editLink.href, 'https://feedback.com/?owner=mapbox&id=streets-v10&access_token=pk.123#/0/0/0', 'edit link contains map location data');
map.setZoom(2);
t.equal(attribution._editLink.href, 'https://feedback.com/?owner=mapbox&id=streets-v10&access_token=pk.123#/0/0/2', 'edit link updates on mapmove');
Expand Down
13 changes: 13 additions & 0 deletions test/unit/ui/control/logo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,16 @@ test('LogoControl appears in compact mode if container is less then 250 pixel wi

t.end();
});

test('LogoControl has `rel` nooper and nofollow', (t) => {
const map = createMap(t);

map.on('load', () => {
const container = map.getContainer();
const logo = container.querySelector('.mapboxgl-ctrl-logo');

t.equal(logo.rel, 'noopener nofollow');

t.end();
});
});