This project is archived and is in readonly mode.

#29 ✓invalid
Thomas Aylott

Document.createElement namepacing issue

Reported by Thomas Aylott | May 28th, 2008 @ 10:05 AM | in 1.3.0 rc2 (closed)

Originally posted on Trac by 131

Original Trac Ticket

Description

Under some browser, you have to use CreateElementNS instead of CreateElement? for defining namespace.

More over, document.namespaceURI is NOT correct

document do not have a namespace, the root element of this document does. so i suggest

this.createElementNS?this.createElementNS(this.documentElement.namespaceURI,tag):this.createElement(tag);

Here is a diff for 1303

http://demo.exyks.org/bugs/diffs...

Trac Attachments

Trac Comments

Changed 6 months ago by 131


        
this bug close http://dev.mootools.net/ticket/377 

      

Changed 6 months ago by 131


        
Demo here : http://demo.exyks.org/bugs/docum... 

      

Changed 3 months ago by 131


        Index: trunk/Source/Element/Element.js
===================================================================
--- trunk/Source/Element/Element.js	(revision 1412)
+++ trunk/Source/Element/Element.js	(working copy)
@@ -6,7 +6,7 @@
 License:
 	MIT-style license.
 */
-
+ 
 Document.implement({
 	
 	newElement: function(tag, props){
@@ -18,7 +18,9 @@
 			});
 			tag = '';
 		}
-		return $.element(this.createElement(tag)).set(props);
+		return $.element(this.createElementNS?
+			this.createElementNS(this.documentElement.namespaceURI,tag)
+			:this.createElement(tag)).set(props);
 	},
 	
 	newTextNode: function(text){

      

Comments and changes to this ticket

  • fakedarren

    fakedarren February 8th, 2010 @ 02:39 PM

    • State changed from “new” to “open”
    • Tag set to defect
    • Assigned user changed from “Valerio” to “Thomas Aylott”
    • Milestone changed from 2.0 to 1.3.0 rc2

    Hey Thomas - can you update this? I know this has been discussed recently with regards to XML / SVG etc etc

  • Thomas Aylott

    Thomas Aylott February 8th, 2010 @ 04:14 PM

    • State changed from “open” to “invalid”
    • Tag changed from defect to defect, xml

    I really don't know how we're doing this currently.
    But I do know that MooTools' core Element is currently only targeting HTML doctypes. (The rest of MooTools is DOM agnostic)

    In 1.3, Slick will explicitly support Selecting elements from XML documents.

    If we do want to fully support using MooTools Element with XML documents we would have to make a concerted effort in that direction and write more specs and another spec runner.

    We might even need to come up with a new native called Node or something.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Tags

Referenced by

Pages