mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,58 @@
|
|||
<!doctype html>
|
||||
<title>Selectors: CSSOM of case-sensitivity attribute selector</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
function new_sheet(use_media) {
|
||||
var style = document.getElementsByTagName('style')[0];
|
||||
if (style)
|
||||
style.parentNode.removeChild(style);
|
||||
style = document.createElement('style');
|
||||
document.head.appendChild(style);
|
||||
if (use_media) {
|
||||
style.textContent = '@media all {}';
|
||||
return style.sheet.cssRules[0];
|
||||
}
|
||||
return style.sheet;
|
||||
}
|
||||
|
||||
var tests = [
|
||||
// test input, expected serialization
|
||||
['[foo="bar"] /* sanity check */', '[foo="bar"]'],
|
||||
['[foo="bar" i]', '[foo="bar" i]'],
|
||||
['[foo="bar" /**/ i]', '[foo="bar" i]'],
|
||||
['[foo="bar"/**/i]', '[foo="bar" i]'],
|
||||
]
|
||||
|
||||
tests.forEach(function(arr) {
|
||||
var input = arr[0];
|
||||
var expected = arr[1];
|
||||
["", " in @media"].forEach(function(use_media) {
|
||||
test(function() {
|
||||
var sheet = new_sheet(use_media);
|
||||
sheet.insertRule(input + ' {}', 0);
|
||||
assert_equals(sheet.cssRules.length, 1);
|
||||
}, input + ' insertRule' + use_media);
|
||||
|
||||
test(function() {
|
||||
var sheet = new_sheet(use_media);
|
||||
sheet.insertRule(input + ' {}', 0);
|
||||
assert_equals(sheet.cssRules[0].cssText.substr(0, expected.length), expected);
|
||||
}, input + ' getting CSSRule#cssText' + use_media);
|
||||
|
||||
test(function() {
|
||||
var sheet = new_sheet(use_media);
|
||||
sheet.insertRule(input + ' {}', 0);
|
||||
assert_equals(sheet.cssRules[0].selectorText, expected);
|
||||
}, input + ' getting CSSStyleRule#selectorText' + use_media);
|
||||
|
||||
test(function() {
|
||||
var sheet = new_sheet(use_media);
|
||||
sheet.insertRule('foobar {}', 0);
|
||||
sheet.cssRules[0].selectorText = input;
|
||||
assert_equals(sheet.cssRules[0].selectorText, expected);
|
||||
}, input + ' setting CSSStyleRule#selectorText' + use_media);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<style></style>
|
||||
<script>
|
||||
var mode = "quirks mode";
|
||||
</script>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style></style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var mode = "XML";
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<style></style>
|
||||
<div id=test foo="BAR"></div>
|
||||
<script>
|
||||
var mode = "quirks mode";
|
||||
</script>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style></style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="test" foo="BAR"/>
|
||||
<script>
|
||||
var mode = "XML";
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
<!doctype html>
|
||||
<title>Selectors: semantics of case-sensitivity attribute selector</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style></style>
|
||||
<div id=log></div>
|
||||
<iframe id="quirks" src="resources/semantics-quirks.html"></iframe>
|
||||
<iframe id="xml" src="resources/semantics-xml.xhtml"></iframe>
|
||||
<script>
|
||||
setup({explicit_done:true});
|
||||
var match = [
|
||||
// [selector, attrs...] (each attr is [ns, name, value])
|
||||
["[foo='BAR'] /* sanity check (match) */", ["", "foo", "BAR"]],
|
||||
["[foo='bar' i]", ["", "foo", "BAR"]],
|
||||
["[foo='' i]", ["", "foo", ""]],
|
||||
["[foo='a\u0308' i] /* COMBINING in both */", ["", "foo", "A\u0308"]],
|
||||
["[foo='A\u0308' i] /* COMBINING in both */", ["", "foo", "a\u0308"]],
|
||||
["[*|foo='bar' i]", ["", "foo", "x"], ["a", "foo", "x"], ["b", "foo", "BAR"], ["c", "foo", "x"]],
|
||||
["[*|foo='bar' i]", ["", "foo", "BAR"], ["a", "foo", "x"], ["b", "foo", "x"], ["c", "foo", "x"]],
|
||||
["[align='left' i]", ["", "align", "LEFT"]],
|
||||
["[align='LEFT' i]", ["", "align", "left"]],
|
||||
["[class~='a' i]", ["", "class", "X A B"]],
|
||||
["[class~='A' i]", ["", "class", "x a b"]],
|
||||
["[id^='a' i]", ["", "id", "AB"]],
|
||||
["[id$='A' i]", ["", "id", "xa"]],
|
||||
["[lang|='a' i]", ["", "lang", "A-B"]],
|
||||
["[lang*='A' i]", ["", "lang", "xab"]],
|
||||
["[*|lang='a' i]", ["http://www.w3.org/XML/1998/namespace", "lang", "A"]],
|
||||
["[*|lang='A' i]", ["http://www.w3.org/XML/1998/namespace", "lang", "a"]],
|
||||
["@namespace x 'http://www.w3.org/XML/1998/namespace'; [x|lang='A' i]", ["http://www.w3.org/XML/1998/namespace", "lang", "a"]],
|
||||
["[foo='bar' i][foo='bar' i]", ["", "foo", "BAR"]],
|
||||
["[foo='BAR'][foo='bar' i]", ["", "foo", "BAR"]],
|
||||
["[foo='bar' i][foo='BAR']", ["", "foo", "BAR"]],
|
||||
];
|
||||
var nomatch = [
|
||||
["[missingattr] /* sanity check (no match) */", ["", "foo", "BAR"]],
|
||||
["[foo='' i]", ["", "foo", "BAR"]],
|
||||
["[foo='\u0000' i] /* \\0 in selector */", ["", "foo", ""]],
|
||||
["[foo='' i] /* \\0 in attribute */", ["", "foo", "\u0000"]],
|
||||
["[foo='\u00E4' i]", ["", "foo", "\u00C4"]],
|
||||
["[foo='\u00C4' i]", ["", "foo", "\u00E4"]],
|
||||
["[foo='a\u0308' i] /* COMBINING in selector */", ["", "foo", "\u00C4"]],
|
||||
["[foo~='a\u0308' i] /* COMBINING in selector */", ["", "foo", "\u00E4"]],
|
||||
["[foo^='A\u0308' i] /* COMBINING in selector */", ["", "foo", "\u00C4"]],
|
||||
["[foo$='A\u0308' i] /* COMBINING in selector */", ["", "foo", "\u00E4"]],
|
||||
["[foo*='\u00E4' i] /* COMBINING in attribute */", ["", "foo", "a\u0308"]],
|
||||
["[foo|='\u00E4' i] /* COMBINING in attribute */", ["", "foo", "A\u0308"]],
|
||||
["[foo='\u00C4' i] /* COMBINING in attribute */", ["", "foo", "a\u0308"]],
|
||||
["[foo='\u00C4' i] /* COMBINING in attribute */", ["", "foo", "A\u0308"]],
|
||||
["[foo='a\u0308' i] /* COMBINING in selector */", ["", "foo", "a"]],
|
||||
["[foo='a\u0308' i] /* COMBINING in selector */", ["", "foo", "A"]],
|
||||
["[foo='A\u0308' i] /* COMBINING in selector */", ["", "foo", "a"]],
|
||||
["[foo='A\u0308' i] /* COMBINING in selector */", ["", "foo", "A"]],
|
||||
["[foo='a' i] /* COMBINING in attribute */", ["", "foo", "a\u0308"]],
|
||||
["[foo='A' i] /* COMBINING in attribute */", ["", "foo", "a\u0308"]],
|
||||
["[foo='a' i] /* COMBINING in attribute */", ["", "foo", "A\u0308"]],
|
||||
["[foo='A' i] /* COMBINING in attribute */", ["", "foo", "A\u0308"]],
|
||||
["[foo='i' i]", ["", "foo", "\u0130"]],
|
||||
["[foo='i' i]", ["", "foo", "\u0131"]],
|
||||
["[foo='I' i]", ["", "foo", "\u0130"]],
|
||||
["[foo='I' i]", ["", "foo", "\u0131"]],
|
||||
["[foo='\u0130' i]", ["", "foo", "i"]],
|
||||
["[foo='\u0131' i]", ["", "foo", "i"]],
|
||||
["[foo='\u0130' i]", ["", "foo", "I"]],
|
||||
["[foo='\u0131' i]", ["", "foo", "I"]],
|
||||
["[foo='bar' i]", ["", "foo", "x"], ["a", "foo", "BAR"]],
|
||||
["[|foo='bar' i]", ["", "foo", "x"], ["a", "foo", "BAR"]],
|
||||
["[foo='bar' i]", ["", "FOO", "bar"]],
|
||||
["[foo='\t' i] /* tab in selector */", ["", "foo", " "]],
|
||||
["[foo=' ' i] /* tab in attribute */", ["", "foo", "\t"]],
|
||||
["@namespace x 'a'; [x|foo='' i]", ["A", "foo", ""]],
|
||||
["@namespace x 'A'; [x|foo='' i]", ["a", "foo", ""]],
|
||||
["[foo='bar' i][foo='bar']", ["", "foo", "BAR"]],
|
||||
["[foo='bar' i]", ["", "baz", "BAR"]],
|
||||
];
|
||||
var mode = "standards mode";
|
||||
function format_attrs(attrs) {
|
||||
var rv = [];
|
||||
attrs.forEach(function(attr) {
|
||||
var str = "";
|
||||
var ns = attr[0];
|
||||
var name = attr[1];
|
||||
var value = attr[2];
|
||||
if (ns)
|
||||
str += "{" + ns + "}";
|
||||
str += name + "=\"" + value + "\"";
|
||||
rv.push(str);
|
||||
});
|
||||
return rv.join(" ");
|
||||
}
|
||||
onload = function() {
|
||||
var quirks = document.getElementById('quirks').contentWindow;
|
||||
var xml = document.getElementById('xml').contentWindow;
|
||||
[window, quirks, xml].forEach(function(global) {
|
||||
var style = global.document.getElementsByTagName('style')[0];
|
||||
var elm;
|
||||
function clean_slate() {
|
||||
style.textContent = '';
|
||||
if (elm)
|
||||
elm.parentNode.removeChild(elm);
|
||||
elm = global.document.createElement('div');
|
||||
global.document.body.appendChild(elm);
|
||||
}
|
||||
function set_attrs(attrs) {
|
||||
attrs.forEach(function(attr) {
|
||||
elm.setAttributeNS(attr[0], attr[1], attr[2]);
|
||||
});
|
||||
}
|
||||
match.forEach(function(arr) {
|
||||
var s = arr[0];
|
||||
var attrs = arr.slice(1);
|
||||
var ns_decl = s.substr(0, "@namespace".length) == "@namespace";
|
||||
test(function() {
|
||||
clean_slate();
|
||||
set_attrs(attrs);
|
||||
style.textContent = s + ' { visibility:hidden }';
|
||||
assert_equals(style.sheet.cssRules.length, (ns_decl ? 2 : 1), 'rule didn\'t parse into CSSOM');
|
||||
assert_equals(global.getComputedStyle(elm).visibility, 'hidden', 'selector didn\'t match');
|
||||
}, s + ' <div ' + format_attrs(attrs) + '> in ' + global.mode);
|
||||
if (!ns_decl) {
|
||||
test(function() {
|
||||
assert_equals(global.document.querySelector(s), elm, 'selector didn\'t match');
|
||||
}, s + ' <div ' + format_attrs(attrs) + '> with querySelector in ' + global.mode);
|
||||
}
|
||||
});
|
||||
nomatch.forEach(function(arr) {
|
||||
var s = arr[0];
|
||||
var attrs = arr.slice(1);
|
||||
var ns_decl = s.substr(0, "@namespace".length) == "@namespace";
|
||||
test(function() {
|
||||
clean_slate();
|
||||
set_attrs(attrs);
|
||||
style.textContent = s + ' { visibility:hidden }';
|
||||
assert_equals(style.sheet.cssRules.length, (ns_decl ? 2 : 1), 'rule didn\'t parse into CSSOM');
|
||||
assert_equals(global.getComputedStyle(elm).visibility, 'visible', 'selector matched');
|
||||
}, s + ' <div ' + format_attrs(attrs) + '> in ' + global.mode);
|
||||
if (!ns_decl) {
|
||||
test(function() {
|
||||
assert_equals(global.document.querySelector(s), null, 'selector matched');
|
||||
}, s + ' <div ' + format_attrs(attrs) + '> with querySelector in ' + global.mode);
|
||||
}
|
||||
});
|
||||
});
|
||||
done();
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<!doctype html>
|
||||
<title>Selectors: syntax of case-sensitivity attribute selector</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style></style>
|
||||
<div id=log></div>
|
||||
<div id=test foo="BAR"></div>
|
||||
<iframe id="quirks" src="resources/syntax-quirks.html"></iframe>
|
||||
<iframe id="xml" src="resources/syntax-xml.xhtml"></iframe>
|
||||
<script>
|
||||
setup({explicit_done:true});
|
||||
var valid = [
|
||||
"[foo='BAR'] /* sanity check (valid) */",
|
||||
"[foo='bar' i]",
|
||||
"[foo='bar' I]",
|
||||
"[foo=bar i]",
|
||||
'[foo="bar" i]',
|
||||
"[foo='bar'i]",
|
||||
"[foo='bar'i ]",
|
||||
"[foo='bar' i ]",
|
||||
"[foo='bar' /**/ i]",
|
||||
"[foo='bar' i /**/ ]",
|
||||
"[foo='bar'/**/i/**/]",
|
||||
"[foo=bar/**/i]",
|
||||
"[foo='bar'\ti\t] /* \\t */",
|
||||
"[foo='bar'\ni\n] /* \\n */",
|
||||
"[foo='bar'\ri\r] /* \\r */",
|
||||
"[foo='bar' \\i]",
|
||||
"[foo='bar' \\69]",
|
||||
"[foo~='bar' i]",
|
||||
"[foo^='bar' i]",
|
||||
"[foo$='bar' i]",
|
||||
"[foo*='bar' i]",
|
||||
"[foo|='bar' i]",
|
||||
"[|foo='bar' i]",
|
||||
"[*|foo='bar' i]",
|
||||
];
|
||||
var invalid = [
|
||||
"[foo[ /* sanity check (invalid) */",
|
||||
"[foo='bar' i i]",
|
||||
"[foo i ='bar']",
|
||||
"[foo= i 'bar']",
|
||||
"[i foo='bar']",
|
||||
"[foo='bar' i\u0000] /* \\0 */",
|
||||
"[foo='bar' \u0130]",
|
||||
"[foo='bar' \u0131]",
|
||||
"[foo='bar' ii]",
|
||||
"[foo='bar' ij]",
|
||||
"[foo='bar' j]",
|
||||
"[foo='bar' \\\\i]",
|
||||
"[foo='bar' \\\\69]",
|
||||
"[foo='bar' i()]",
|
||||
"[foo='bar' i ()]",
|
||||
"[foo='bar' () i]",
|
||||
"[foo='bar' (i)]",
|
||||
"[foo='bar' i []]",
|
||||
"[foo='bar' [] i]",
|
||||
"[foo='bar' [i]]",
|
||||
"[foo='bar' i {}]",
|
||||
"[foo='bar' {} i]",
|
||||
"[foo='bar' {i}]",
|
||||
"[foo='bar' 1i]",
|
||||
"[foo='bar' 1]",
|
||||
"[foo='bar' 'i']",
|
||||
"[foo='bar' url(i)]",
|
||||
"[foo='bar' ,i]",
|
||||
"[foo='bar' i,]",
|
||||
"[foo='bar']i",
|
||||
"[foo='bar' |i]",
|
||||
"[foo='bar' \\|i]",
|
||||
"[foo='bar' *|i]",
|
||||
"[foo='bar' \\*|i]",
|
||||
"[foo='bar' *]",
|
||||
"[foo='bar' \\*]",
|
||||
"[foo i]",
|
||||
"[foo/**/i]",
|
||||
];
|
||||
var mode = "standards mode";
|
||||
onload = function() {
|
||||
var quirks = document.getElementById('quirks').contentWindow;
|
||||
var xml = document.getElementById('xml').contentWindow;
|
||||
[window, quirks, xml].forEach(function(global) {
|
||||
var style = global.document.getElementsByTagName('style')[0];
|
||||
var elm = global.document.getElementById('test');
|
||||
function clean_slate() {
|
||||
style.textContent = '';
|
||||
assert_equals(style.sheet.cssRules.length, 0, 'CSSOM was not empty for empty stylesheet');
|
||||
assert_equals(global.getComputedStyle(elm).visibility, 'visible', 'computed style for empty stylesheet');
|
||||
}
|
||||
valid.forEach(function(s) {
|
||||
test(function() {
|
||||
clean_slate();
|
||||
style.textContent = s + ' { visibility:hidden }';
|
||||
assert_equals(style.sheet.cssRules.length, 1, 'valid rule didn\'t parse into CSSOM');
|
||||
assert_equals(global.getComputedStyle(elm).visibility, 'hidden', 'valid selector didn\'t match');
|
||||
}, s + ' in ' + global.mode);
|
||||
test(function() {
|
||||
assert_equals(global.document.querySelector(s), elm, 'valid selector');
|
||||
}, s + ' with querySelector in ' + global.mode);
|
||||
});
|
||||
invalid.forEach(function(s) {
|
||||
test(function() {
|
||||
clean_slate();
|
||||
style.textContent = s + ' { visibility:hidden }';
|
||||
assert_equals(style.sheet.cssRules.length, 0, 'invalid rule parsed into CSSOM');
|
||||
assert_equals(global.getComputedStyle(elm).visibility, 'visible', 'invalid selector matched');
|
||||
}, s + ' in ' + global.mode);
|
||||
test(function() {
|
||||
// Should be TypeError but this is not widely implemented yet
|
||||
// and this isn't intended to be a querySelector API conformance test.
|
||||
assert_throws(null, function() {
|
||||
global.document.querySelector(s);
|
||||
}, 'invalid selector');
|
||||
}, s + ' with querySelector in ' + global.mode);
|
||||
});
|
||||
});
|
||||
done();
|
||||
};
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue