|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
668 bytes
|
| Line | |
|---|
| 1 | import namespace from "./namespace.js";
|
|---|
| 2 | import {xhtml} from "./namespaces.js";
|
|---|
| 3 |
|
|---|
| 4 | function creatorInherit(name) {
|
|---|
| 5 | return function() {
|
|---|
| 6 | var document = this.ownerDocument,
|
|---|
| 7 | uri = this.namespaceURI;
|
|---|
| 8 | return uri === xhtml && document.documentElement.namespaceURI === xhtml
|
|---|
| 9 | ? document.createElement(name)
|
|---|
| 10 | : document.createElementNS(uri, name);
|
|---|
| 11 | };
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | function creatorFixed(fullname) {
|
|---|
| 15 | return function() {
|
|---|
| 16 | return this.ownerDocument.createElementNS(fullname.space, fullname.local);
|
|---|
| 17 | };
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | export default function(name) {
|
|---|
| 21 | var fullname = namespace(name);
|
|---|
| 22 | return (fullname.local
|
|---|
| 23 | ? creatorFixed
|
|---|
| 24 | : creatorInherit)(fullname);
|
|---|
| 25 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.