let runTests = t.step_func_done(function() {
testFindable(true, "me and me", `
me <divstyle="display: contents">and</div> me
`, "display: contents");
testFindable(true, "me me", `
me <divstyle="display: none">and</div> me
`, "display: none");
testFindable(false, "me and me", `
me <divstyle="display: none">and</div> me
`, "display: none");
for (const display of INLINE_LIKE_DISPLAY_VALUES) {
testFindable(true, "me and me", `
me <divstyle="display: ${display}">and</div> me
`, "div display: " + display);
testFindable(true, "me and me", `
me <spanstyle="display: ${display}">and</span> me
`, "span display: " + display);
}
for (const display of BLOCK_LIKE_DISPLAY_VALUES) {
testFindable(false, "me and me", `
me <divstyle="display: ${display}">and</div> me
`, "div display: " + display);
testFindable(false, "me and me", `
me <spanstyle="display: ${display}">and</span> me
`, "span display: " + display);
}
testFindable(false, "me and me", `
me <fieldset>and</fieldset> me
`);
testFindable(true, "This text should be visible", `
<divstyle="visibility: hidden">
<divstyle="visibility: visible">
This text should be visible
</div>
</div>
`);
testFindable(true, "This text should be visible", `
<style>:root { overflow: hidden }</style>
<divstyle="overflow: auto;">
<divstyle="height: 300vh"></div>
This text should be visible
</div>
`);
testFindable(true, "Shadow text", function(document) {
let div = document.createElement("div"); div.attachShadow({ mode: "open" }).innerHTML = `
Wohoo, this is Shadow text, yay!
`;
document.documentElement.appendChild(div);
}, "In Shadow DOM");
testFindable(true, "Shadow text", function(document) {
let div = document.createElement("div"); div.appendChild(document.createTextNode( "Wohoo, this is Shadow text, yay!"
)); div.attachShadow({ mode: "open" }).innerHTML = `<slot></slot>`;
document.documentElement.appendChild(div);
}, "Slotted content in Shadow DOM");
// TODO(emilio): This should work in an ideal world.
testFindable(false, "Shadow text", function(document) {
let div = document.createElement("div"); div.appendChild(document.createTextNode("text, yay!")); div.attachShadow({ mode: "open" }).innerHTML = `This is Shadow <slot></slot>`;
document.documentElement.appendChild(div);
}, "Mixed shadow and non-shadow text");
// NOTE(emilio): It is probably doable / worth changing this to return true,
// maybe, by relaxing the security checks in the ranges nsFind returns or
// such.
//
// See bug 1442466 / bug 1510485 / bug 1505887.
testFindable(false, "foo", function(document) {
let input = document.createElement("input"); input.value = "foo";
document.documentElement.appendChild(input);
}, "Native anonymous content isn't exposed in window.find");
// Same as above, but in this case the check is warranted, we shouldn't
// expose this range.
testFindable(false, "find me", `
<style>div::before { content: "Do find me" }</style>
<div></div>
`, "Pseudo-element");
// Same as above.
testFindable(false, "find me", `
<img alt="Do find me">
`, "Image alt content");
// Same as above.
testFindable(false, "find me", `
<input type="submit" value="Do find me">
`, "Submit input value");
testFindable(false, "ab", `a<br>b`, " forces a break even if there's no whitespace in between");
testFindable(true, "history.kafka", `
<code>database.history.kafka.bootstrap.servers</code>
`, "ZWSP should be ignored");
testFindable(2, " ", "a b c", "Collapsed whitespace");
// TODO(emilio): This might be worth discussing in the spec. For now
// hard-coding our implementation.
testFindable(false, "find me", `
Do you find <span inert>not findable</span> me?
`, "boundary-crossing inert");
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.