css-selectors-case-sensitivity.html (3273B)
1 <!doctype html> 2 <title>SVG CSS Selectors - Case-sensitivity</title> 3 <link rel="help" href="https://svgwg.org/svg2-draft/styling.html"> 4 <link rel="help" href="https://drafts.csswg.org/selectors/#case-sensitive"> 5 <link rel="help" href="https://drafts.csswg.org/selectors/#attribute-case"> 6 <link rel="help" href="https://crbug.com/1246296"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <style> 10 [viewBox] { color: green } 11 [VIEWBOX] { background-color: green } 12 foreignObject { color: green } 13 FOREIGNOBJECT { background-color: green } 14 </style> 15 <div viewBox id="t1"></div> 16 <div viewbox id="t2"></div> 17 <svg viewBox="0 0 800 10" id="t3"></svg> 18 <svg VIEWBOX="0 0 800 10" id="t4"></svg> 19 <foreignObject id="t5"></div> 20 <foreignobject id="t6"></div> 21 <svg><foreignObject id="t7"></foreignObject></svg> 22 <svg><FOREIGNOBJECT id="t8"></FOREIGNOBJECT></svg> 23 <script> 24 test(() => { 25 assert_equals(t1.attributes[0].name, "viewbox"); 26 assert_equals(t2.attributes[0].name, "viewbox"); 27 assert_equals(t3.attributes[0].name, "viewBox"); 28 assert_equals(t4.attributes[0].name, "viewBox"); 29 }, "Normalization of viewBox on html and svg elements in html documents."); 30 31 test(() => { 32 assert_equals(t5.localName, "foreignobject"); 33 assert_equals(t6.localName, "foreignobject"); 34 assert_equals(t7.localName, "foreignObject"); 35 assert_equals(t8.localName, "foreignObject"); 36 }, "Normalization of foreignObject html and svg elements in html documents."); 37 38 test(() => { 39 assert_equals(getComputedStyle(t1).color, "rgb(0, 128, 0)"); 40 assert_equals(getComputedStyle(t1).backgroundColor, "rgb(0, 128, 0)"); 41 assert_equals(getComputedStyle(t2).color, "rgb(0, 128, 0)"); 42 assert_equals(getComputedStyle(t2).backgroundColor, "rgb(0, 128, 0)"); 43 }, "viewBox attribute without namespace on html element matches case-insensitively in html document."); 44 45 test(() => { 46 assert_equals(getComputedStyle(t3).color, "rgb(0, 128, 0)"); 47 assert_equals(getComputedStyle(t3).backgroundColor, "rgba(0, 0, 0, 0)"); 48 }, "Camel-cased viewBox on svg in html document matches sensitively."); 49 50 test(() => { 51 assert_equals(getComputedStyle(t4).color, "rgb(0, 128, 0)"); 52 assert_equals(getComputedStyle(t4).backgroundColor, "rgba(0, 0, 0, 0)"); 53 }, "Normalized camel-cased viewBox on svg in html document matches case-sensitively."); 54 55 test(() => { 56 assert_equals(getComputedStyle(t5).color, "rgb(0, 128, 0)"); 57 assert_equals(getComputedStyle(t5).backgroundColor, "rgb(0, 128, 0)"); 58 assert_equals(getComputedStyle(t6).color, "rgb(0, 128, 0)"); 59 assert_equals(getComputedStyle(t6).backgroundColor, "rgb(0, 128, 0)"); 60 }, "foreignObject html element matches case-insensitively in html document."); 61 62 test(() => { 63 assert_equals(getComputedStyle(t7).color, "rgb(0, 128, 0)"); 64 assert_equals(getComputedStyle(t7).backgroundColor, "rgba(0, 0, 0, 0)"); 65 }, "Camel-cased svg foreignObject in html document matches sensitively."); 66 67 test(() => { 68 assert_equals(getComputedStyle(t8).color, "rgb(0, 128, 0)"); 69 assert_equals(getComputedStyle(t8).backgroundColor, "rgba(0, 0, 0, 0)"); 70 }, "Normalized camel-cased svg foreignObject in html document matches case-sensitively."); 71 </script>