Skip to content

Commit

Permalink
Use ASCII uppercase for tagName
Browse files Browse the repository at this point in the history
  • Loading branch information
Zirro authored and domenic committed May 27, 2019
1 parent 1c8e963 commit 1951a19
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/jsdom/living/helpers/strings.js
Expand Up @@ -8,6 +8,11 @@ exports.asciiLowercase = s => {
return s.replace(/[A-Z]/g, l => l.toLowerCase());
};

// https://infra.spec.whatwg.org/#ascii-uppercase
exports.asciiUppercase = s => {
return s.replace(/[a-z]/g, l => l.toUpperCase());
};

// https://infra.spec.whatwg.org/#strip-newlines
exports.stripNewlines = s => {
return s.replace(/[\n\r]+/g, "");
Expand Down
4 changes: 2 additions & 2 deletions lib/jsdom/living/nodes/Element-impl.js
Expand Up @@ -17,7 +17,7 @@ const DOMTokenList = require("../generated/DOMTokenList");
const attrGenerated = require("../generated/Attr");
const NamedNodeMap = require("../generated/NamedNodeMap");
const validateNames = require("../helpers/validate-names");
const { asciiLowercase } = require("../helpers/strings");
const { asciiLowercase, asciiUppercase } = require("../helpers/strings");
const { listOfElementsWithQualifiedName, listOfElementsWithNamespaceAndLocalName,
listOfElementsWithClassNames } = require("../node");
const SlotableMixinImpl = require("./Slotable-impl").implementation;
Expand Down Expand Up @@ -132,7 +132,7 @@ class ElementImpl extends NodeImpl {
get tagName() {
let qualifiedName = this._qualifiedName;
if (this.namespaceURI === HTML_NS && this._ownerDocument._parsingMode === "html") {
qualifiedName = qualifiedName.toUpperCase();
qualifiedName = asciiUppercase(qualifiedName);
}
return qualifiedName;
}
Expand Down
1 change: 0 additions & 1 deletion test/web-platform-tests/to-run.yaml
Expand Up @@ -130,7 +130,6 @@ Document-characterSet-normalization.html: [timeout, Some encodings are not suppo
Document-constructor-svg.svg: [fail, Unknown]
Document-constructor-xml.xml: [fail, Unknown]
Document-constructor.html: [fail, new Document().origin should inherit from current Document]
Document-createElement.html: [fail, Unknown]
Document-createEvent.https.html: [fail, We don't support every event interface yet]
Document-getElementById.html: [fail, We cache IDs in insertion order]
Document-importNode.html: [fail, Attr should be a Node, https://github.com/jsdom/jsdom/issues/1641]
Expand Down

0 comments on commit 1951a19

Please sign in to comment.