Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Document-createElement.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Document-createElement.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Document-createElement.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Document-createElement.html
new file mode 100644
index 0000000000000000000000000000000000000000..316b2e67bf38b7f53a9b1199974b5368ba0a651a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Document-createElement.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Document.createElement</title>
+<link rel=help href="https://dom.spec.whatwg.org/#dom-document-createelement">
+<link rel=help href="https://dom.spec.whatwg.org/#dom-element-localname">
+<link rel=help href="https://dom.spec.whatwg.org/#dom-element-tagname">
+<link rel=help href="https://dom.spec.whatwg.org/#dom-element-prefix">
+<link rel=help href="https://dom.spec.whatwg.org/#dom-element-namespaceuri">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+function toASCIIUppercase(str) {
+ var diff = "a".charCodeAt(0) - "A".charCodeAt(0);
+ var res = "";
+ for (var i = 0; i < str.length; ++i) {
+ if ("a" <= str[i] && str[i] <= "z") {
+ res += String.fromCharCode(str.charCodeAt(i) - diff);
+ } else {
+ res += str[i];
+ }
+ }
+ return res;
+}
+test(function() {
+ var HTMLNS = "http://www.w3.org/1999/xhtml",
+ valid = [
+ //[input, localName],
+ [undefined, "undefined"],
+ [null, "null"],
+ ["foo", "foo"],
+ ["f1oo", "f1oo"],
+ ["foo1", "foo1"],
+ ["f\u0300oo", "f\u0300oo"],
+ ["foo\u0300", "foo\u0300"],
+ [":foo", ":foo"],
+ ["f:oo", "f:oo"],
+ ["foo:", "foo:"],
+ ["xml", "xml"],
+ ["xmlns", "xmlns"],
+ ["xmlfoo", "xmlfoo"],
+ ["xml:foo", "xml:foo"],
+ ["xmlns:foo", "xmlns:foo"],
+ ["xmlfoo:bar", "xmlfoo:bar"],
+ ["svg", "svg"],
+ ["math", "math"],
+ ["FOO", "foo"],
+ ["mar\u212a", "mar\u212a"],
+ ["\u0130nput", "\u0130nput"],
+ ["\u0131nput", "\u0131nput"]
+ ],
+ invalid = [
+ "",
+ "1foo",
+ "\u0300foo",
+ "}foo",
+ "f}oo",
+ "foo}",
+ "\ufffffoo",
+ "f\uffffoo",
+ "foo\uffff",
+ "<foo",
+ "foo>",
+ "<foo>",
+ "f<oo"
+ ]
+
+ valid.forEach(function(t) {
+ test(function() {
+ var elt = document.createElement(t[0])
+ assert_true(elt instanceof Element)
+ assert_true(elt instanceof Node)
+ assert_equals(elt.localName, t[1])
+ assert_equals(elt.tagName, toASCIIUppercase(t[1]))
+ assert_equals(elt.prefix, null)
+ assert_equals(elt.namespaceURI, HTMLNS)
+ }, "createElement(" + format_value(t[0]) + ")");
+ });
+ invalid.forEach(function(arg) {
+ test(function() {
+ assert_throws("INVALID_CHARACTER_ERR", function() { document.createElement(arg) })
+ }, "createElement(" + format_value(arg) + ")");
+ });
+})
+</script>

Powered by Google App Engine
This is Rietveld 408576698