Fixes no rel noopener when properties of anchor element cannot be resolved anymore (#1818)
* Fixes no rel noopener when anchor element is not available anymore. #1802 * Change rellnoopener to getAttribute('href')
This commit is contained in:
Родитель
07b8d3f16f
Коммит
91ad83a37c
|
@ -39,9 +39,11 @@ module.exports = [
|
||||||
},
|
},
|
||||||
'external-anchors-use-rel-noopener': {
|
'external-anchors-use-rel-noopener': {
|
||||||
score: false,
|
score: false,
|
||||||
|
debugString: 'Lighthouse was unable to determine the destination of some anchor tags. ' +
|
||||||
|
'If they are not used as hyperlinks, consider removing the _blank target.',
|
||||||
extendedInfo: {
|
extendedInfo: {
|
||||||
value: {
|
value: {
|
||||||
length: 2
|
length: 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -494,7 +494,7 @@ class Driver {
|
||||||
* @return {!Promise<string>} The property value, or null, if property not found
|
* @return {!Promise<string>} The property value, or null, if property not found
|
||||||
*/
|
*/
|
||||||
getObjectProperty(objectId, propName) {
|
getObjectProperty(objectId, propName) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise(resolve => {
|
||||||
this.sendCommand('Runtime.getProperties', {
|
this.sendCommand('Runtime.getProperties', {
|
||||||
objectId,
|
objectId,
|
||||||
accessorPropertiesOnly: true,
|
accessorPropertiesOnly: true,
|
||||||
|
@ -508,7 +508,7 @@ class Driver {
|
||||||
if (propertyForName) {
|
if (propertyForName) {
|
||||||
resolve(propertyForName.value.value);
|
resolve(propertyForName.value.value);
|
||||||
} else {
|
} else {
|
||||||
reject(null);
|
resolve(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,7 +29,7 @@ class AnchorsWithNoRelNoopener extends Gatherer {
|
||||||
.then(failingNodeList => {
|
.then(failingNodeList => {
|
||||||
const failingNodes = failingNodeList.map(node => {
|
const failingNodes = failingNodeList.map(node => {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
node.getProperty('href'),
|
node.getAttribute('href'),
|
||||||
node.getAttribute('rel'),
|
node.getAttribute('rel'),
|
||||||
node.getAttribute('target')
|
node.getAttribute('target')
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -43,6 +43,7 @@ class Element {
|
||||||
if (attrIndex === -1) {
|
if (attrIndex === -1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.attributes[attrIndex + 1];
|
return resp.attributes[attrIndex + 1];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче