blob: 4a38abe80457736864aa71820fe0dba1e05a99cb [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div style="display:none">
<div id=div1 style="background-color: red; position: absolute; left:0; width:50px; height:50px" lang="FooBar"></div>
<div id=div2 style="background-color: red; position: absolute; left:50px; width:50px; height:50px" link="FooBar"></div>
<div id=div3 style="background-color: red; position: absolute; left:100px; width:50px; height:50px" lang="foobar"></div>
<div id=div4 style="background-color: red; position: absolute; left:150px; width:50px; height:50px" link="foobar"></div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100" style="margin-top:50px">
<rect id=rect1 x="50" y="0" width="50" height="50" lang="FooBar" style="fill:green" />
<rect id=rect2 x="0" y="0" width="50" height="50" link="FooBar" style="fill:green" />
<rect id=rect3 x="0" y="50" width="50" height="50" lang="foobar" style="fill:red" />
<rect id=rect4 x="50" y="50" width="50" height="50" link="foobar" style="fill:red" />
</svg>
</div>
</body>
<script>
description('Some attribute needs case insensitive value matching with HTML, they should not match XML elements like SVG. On the other hand, explicitely case-insensitive selector should match SVG.');
shouldBe('document.querySelectorAll("[lang=foobar]").length', '3');
shouldBeEqualToString('document.querySelectorAll("[lang=foobar]")[0].id', 'div1');
shouldBeEqualToString('document.querySelectorAll("[lang=foobar]")[1].id', 'div3');
shouldBeEqualToString('document.querySelectorAll("[lang=foobar]")[2].id', 'rect3');
shouldBe('document.querySelectorAll("[lang=foobar i]").length', '4');
shouldBeEqualToString('document.querySelectorAll("[lang=foobar i]")[0].id', 'div1');
shouldBeEqualToString('document.querySelectorAll("[lang=foobaR i]")[1].id', 'div3');
shouldBeEqualToString('document.querySelectorAll("[lang=Foobar i]")[2].id', 'rect1');
shouldBeEqualToString('document.querySelectorAll("[lang=FOOBAR i]")[3].id', 'rect3');
shouldBe('document.querySelectorAll("[link=foobar]").length', '3');
shouldBeEqualToString('document.querySelectorAll("[link=foobar]")[0].id', 'div2');
shouldBeEqualToString('document.querySelectorAll("[link=foobar]")[1].id', 'div4');
shouldBeEqualToString('document.querySelectorAll("[link=foobar]")[2].id', 'rect4');
shouldBe('document.querySelectorAll("[link=foobar i]").length', '4');
shouldBeEqualToString('document.querySelectorAll("[link=foobar i]")[0].id', 'div2');
shouldBeEqualToString('document.querySelectorAll("[link=FOOBAR i]")[1].id', 'div4');
shouldBeEqualToString('document.querySelectorAll("[link=foobaR i]")[2].id', 'rect2');
shouldBeEqualToString('document.querySelectorAll("[link=Foobar i]")[3].id', 'rect4');
</script>
<script src="../../resources/js-test-post.js"></script>
</html>