Skip to content

Commit

Permalink
Only use createElement for HTML.
Browse files Browse the repository at this point in the history
Related d3/d3#2737.
  • Loading branch information
mbostock committed Feb 18, 2016
1 parent d779816 commit 8044b25
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-selection",
"version": "0.6.10",
"version": "0.6.11",
"description": "Data-driven DOM manipulation: select elements and join them to data.",
"keywords": [
"d3",
Expand Down
7 changes: 4 additions & 3 deletions src/creator.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import namespace from "./namespace";
import {xhtml} from "./namespaces";

function creatorInherit(name) {
return function() {
var document = this.ownerDocument,
uri = this.namespaceURI;
return uri && uri !== document.documentElement.namespaceURI
? document.createElementNS(uri, name)
: document.createElement(name);
return uri === xhtml && document.documentElement.namespaceURI === xhtml
? document.createElement(name)
: document.createElementNS(uri, name);
};
}

Expand Down
4 changes: 3 additions & 1 deletion src/namespaces.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export var xhtml = "http://www.w3.org/1999/xhtml";

export default {
svg: "http://www.w3.org/2000/svg",
xhtml: "http://www.w3.org/1999/xhtml",
xhtml: xhtml,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
Expand Down

0 comments on commit 8044b25

Please sign in to comment.