import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,34 @@
<!doctype html>
<meta charset="utf-8">
<title>DOMTokenList Iterable Test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<span class="foo Foo foo "></span>
<script>
var elementClasses;
setup(function() {
elementClasses = document.querySelector("span").classList;
})
test(function() {
assert_true('length' in elementClasses);
}, 'DOMTokenList has length method.');
test(function() {
assert_true('values' in elementClasses);
}, 'DOMTokenList has values method.');
test(function() {
assert_true('entries' in elementClasses);
}, 'DOMTokenList has entries method.');
test(function() {
assert_true('forEach' in elementClasses);
}, 'DOMTokenList has forEach method.');
test(function() {
assert_true(Symbol.iterator in elementClasses);
}, 'DOMTokenList has Symbol.iterator.');
test(function() {
var classList = [];
for (var className of elementClasses){
classList.push(className);
}
assert_array_equals(classList, ['foo', 'Foo']);
}, 'DOMTokenList is iterable via for-of loop.');
</script>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>DOMTokenList coverage for attributes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
"use strict";
var pairs = [
// Defined in DOM
{attr: "classList", sup: ["anyElement"]},
// Defined in HTML
{attr: "dropzone", sup: ["anyHTMLElement"]},
{attr: "htmlFor", sup: ["output"]},
{attr: "relList", sup: ["a", "area", "link"]},
{attr: "sandbox", sup: ["iframe"]},
{attr: "sizes", sup: ["link"]}
];
var namespaces = [
"http://www.w3.org/1999/xhtml",
"http://www.w3.org/2000/svg",
"http://www.w3.org/1998/Math/MathML",
"http://example.com/",
""
];
var elements = ["a", "area", "link", "iframe", "output", "td", "th"];
function testAttr(pair, new_el){
return (pair.attr === "classList" || (new_el.namespaceURI === "http://www.w3.org/1999/xhtml" && (pair.attr === "dropzone" || pair.sup.indexOf(new_el.localName) != -1)));
}
pairs.forEach(function(pair) {
namespaces.forEach(function(ns) {
elements.forEach(function(el) {
var new_el = document.createElementNS(ns, el);
if (testAttr(pair, new_el)) {
test(function() {
assert_class_string(new_el[pair.attr], "DOMTokenList");
}, new_el.localName + "." + pair.attr + " in " + new_el.namespaceURI + " namespace should be DOMTokenList.");
}
else {
test(function() {
assert_equals(new_el[pair.attr], undefined);
}, new_el.localName + "." + pair.attr + " in " + new_el.namespaceURI + " namespace should be undefined.");
}
});
});
});
</script>

View file

@ -0,0 +1,50 @@
<!doctype html>
<meta charset=utf-8>
<title>DOMTokenList iteration: keys, values, etc.</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<span class=" a a b "></span>
<script>
test(function() {
var list = document.querySelector("span").classList;
assert_array_equals([...list], ["a", "a", "b"]);
var keys = list.keys();
assert_false(keys instanceof Array);
keys = [...keys];
assert_array_equals(keys, [0, 1, 2]);
var values = list.values();
assert_false(values instanceof Array);
values = [...values];
assert_array_equals(values, ["a", "a", "b"]);
var entries = list.entries();
assert_false(entries instanceof Array);
entries = [...entries];
assert_equals(entries.length, keys.length);
assert_equals(entries.length, values.length);
for (var i = 0; i < entries.length; ++i) {
assert_array_equals(entries[i], [keys[i], values[i]]);
}
var cur = 0;
var thisObj = {};
list.forEach(function(value, key, listObj) {
assert_equals(listObj, list);
assert_equals(this, thisObj);
assert_equals(value, values[cur]);
assert_equals(key, keys[cur]);
cur++;
}, thisObj);
assert_equals(cur, entries.length);
assert_equals(list[Symbol.iterator], Array.prototype[Symbol.iterator]);
assert_equals(list.keys, Array.prototype.keys);
if (Array.prototype.values) {
assert_equals(list.values, Array.prototype.values);
}
assert_equals(list.entries, Array.prototype.entries);
assert_equals(list.forEach, Array.prototype.forEach);
});
</script>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>DOMTokenList stringifier</title>
<link rel=help href="https://dom.spec.whatwg.org/#dom-domtokenlist-stringifier">
<link rel=author title=Ms2ger href="mailto:Ms2ger@gmail.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<span class=" a a b "></span>
<script>
test(function() {
assert_equals(String(document.createElement("span").classList), "",
"String(classList) should return the empty list for an undefined class attribute");
var span = document.querySelector("span");
assert_equals(span.getAttribute("class"), " a a b ",
"getAttribute should return the literal value");
assert_equals(span.className, " a a b ",
"className should return the literal value");
assert_equals(String(span.classList), " a a b ",
"String(classList) should return the literal value");
assert_equals(span.classList.toString(), " a a b ",
"classList.toString() should return the literal value");
assert_class_string(span.classList, "DOMTokenList");
});
</script>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>DOMTokenList value</title>
<link rel=help href="https://dom.spec.whatwg.org/#dom-domtokenlist-value">
<link rel=author title=Tangresh href="mailto:dmenzi@tangresh.ch">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<span class=" a a b "></span>
<script>
test(function() {
assert_equals(String(document.createElement("span").classList.value), "",
"classList.value should return the empty list for an undefined class attribute");
var span = document.querySelector("span");
assert_equals(span.classList.value, " a a b ",
"value should return the literal value");
span.classList.value = " foo bar foo ";
assert_equals(span.classList.value, " foo bar foo ",
"assigning value should set the literal value");
assert_equals(span.classList.length, 2,
"length should be the number of tokens");
assert_class_string(span.classList, "DOMTokenList");
assert_class_string(span.classList.value, "String");
});
</script>