Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Infer namespaces for root element.
Now if you add an "svg" element, we automatically infer the namespace because there is an "svg" namespace prefix. In conjunction with inheriting the namespace from the parent element, this means that namespaces are almost optional!
- Loading branch information
Showing
4 changed files
with
31 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,19 +1,17 @@ | |||
d3.ns = { | var d3_nsPrefix = { | ||
|
svg: "http://www.w3.org/2000/svg", | ||
prefix: { | xhtml: "http://www.w3.org/1999/xhtml", | ||
svg: "http://www.w3.org/2000/svg", | xlink: "http://www.w3.org/1999/xlink", | ||
xhtml: "http://www.w3.org/1999/xhtml", | xml: "http://www.w3.org/XML/1998/namespace", | ||
xlink: "http://www.w3.org/1999/xlink", | xmlns: "http://www.w3.org/2000/xmlns/" | ||
xml: "http://www.w3.org/XML/1998/namespace", | }; | ||
xmlns: "http://www.w3.org/2000/xmlns/" | |||
}, | |||
|
|
||
d3.ns = { | |||
prefix: d3_nsPrefix, | |||
qualify: function(name) { | qualify: function(name) { | ||
var i = name.indexOf(":"); | var i = name.indexOf(":"); | ||
return i < 0 ? name : { | return i < 0 ? (name in d3_nsPrefix | ||
space: d3.ns.prefix[name.substring(0, i)], | ? {space: d3_nsPrefix[name], local: name} : name) | ||
local: name.substring(i + 1) | : {space: d3_nsPrefix[name.substring(0, i)], local: name.substring(i + 1)}; | ||
}; | |||
} | } | ||
|
|||
}; | }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters