Skip to content

Commit 8044b25

Browse files
committed
Only use createElement for HTML.
Related d3/d3#2737.
1 parent d779816 commit 8044b25

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "d3-selection",
3-
"version": "0.6.10",
3+
"version": "0.6.11",
44
"description": "Data-driven DOM manipulation: select elements and join them to data.",
55
"keywords": [
66
"d3",

src/creator.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import namespace from "./namespace";
2+
import {xhtml} from "./namespaces";
23

34
function creatorInherit(name) {
45
return function() {
56
var document = this.ownerDocument,
67
uri = this.namespaceURI;
7-
return uri && uri !== document.documentElement.namespaceURI
8-
? document.createElementNS(uri, name)
9-
: document.createElement(name);
8+
return uri === xhtml && document.documentElement.namespaceURI === xhtml
9+
? document.createElement(name)
10+
: document.createElementNS(uri, name);
1011
};
1112
}
1213

src/namespaces.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
export var xhtml = "http://www.w3.org/1999/xhtml";
2+
13
export default {
24
svg: "http://www.w3.org/2000/svg",
3-
xhtml: "http://www.w3.org/1999/xhtml",
5+
xhtml: xhtml,
46
xlink: "http://www.w3.org/1999/xlink",
57
xml: "http://www.w3.org/XML/1998/namespace",
68
xmlns: "http://www.w3.org/2000/xmlns/"

0 commit comments

Comments
 (0)