browser_markup_anonymous_01.js (1570B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test native anonymous content in the markupview. 7 const TEST_URL = URL_ROOT + "doc_markup_anonymous.html"; 8 9 add_task(async function () { 10 const { inspector } = await openInspectorForURL(TEST_URL); 11 12 const pseudo = await getNodeFront("#pseudo", inspector); 13 14 // Markup looks like: <div><::before /><span /><::after /></div> 15 const children = await inspector.walker.children(pseudo); 16 is(children.nodes.length, 3, "Children returned from walker"); 17 18 info("Checking the ::before pseudo element"); 19 const before = children.nodes[0]; 20 await isEditingMenuDisabled(before, inspector); 21 22 info("Checking the normal child element"); 23 const span = children.nodes[1]; 24 await isEditingMenuEnabled(span, inspector); 25 26 info("Checking the ::after pseudo element"); 27 const after = children.nodes[2]; 28 await isEditingMenuDisabled(after, inspector); 29 30 const native = await getNodeFront("#native", inspector); 31 32 // Markup looks like: <div><input type="file"></div> 33 const nativeChildren = await inspector.walker.children(native); 34 is(nativeChildren.nodes.length, 1, "Children returned from walker"); 35 36 info("Checking the input element"); 37 const child = nativeChildren.nodes[0]; 38 ok(!child.isNativeAnonymous, "<input type=file> is not anonymous"); 39 40 const grandchildren = await inspector.walker.children(child); 41 is( 42 grandchildren.nodes.length, 43 0, 44 "No native children returned from walker for <input type=file> by default" 45 ); 46 });