This project is archived and is in readonly mode.

#839 ✓wontfix
Yorick Sijsling

Custom namespace in document.newElement

Reported by Yorick Sijsling | January 31st, 2010 @ 05:11 PM | in 1.3.0 rc2 (closed)

This ticket is related to #29.

I am trying to create an element which needs to use the http://www.w3.org/2000/svg namespace. This is not possible in the current version of mootools.

I would suggest the ability to pass a namespace to the document.newElement function.
For my project i have replaced this line:

return document.id(this.createElement(tag)).set(props);
By this line:
return document.id($defined(namespace) ? this.createElementNS(namespace, tag) : this.createElement(tag)).set(props);

Note that createElementNS is not available in IE.

Comments and changes to this ticket

  • Yorick Sijsling

    Yorick Sijsling January 31st, 2010 @ 05:44 PM

    I have created a mooshell to test this issue:
    http://mootools.net/shell/N73y9/1/

    I have tested it succesfully in Firefox and Safari on mac.

  • Yorick Sijsling

    Yorick Sijsling January 31st, 2010 @ 11:58 PM

    This code was still giving problems when setting a class:

    document.newElementNS('svg', { class: 'myClass' }, 'http://www.w3.org/2000/svg');
    
    Which is fixed with my suggestion for #841.
  • Fábio M. Costa

    Fábio M. Costa February 6th, 2010 @ 05:22 PM

    is there an alternative for IE? We cant do something that works just on some browsers.

    Thanks for the valuable report (detailed with code and fix, good job).

  • fakedarren

    fakedarren February 8th, 2010 @ 07:22 PM

    • Milestone changed from 2.0 to 1.3.0 rc2
    • State changed from “new” to “hold”
    • Assigned user set to “Thomas Aylott”

    I know (think) we don't intend to support this as 'core'. Thomas, can you express why, better than I?

  • Yorick Sijsling

    Yorick Sijsling February 8th, 2010 @ 08:41 PM

    There is no alternative for IE. Not even for IE8.
    I understand why you don't intend to support this as core. At least it's possible to work around it with a relatively low risk of breaking things.

  • fakedarren

    fakedarren February 15th, 2010 @ 10:27 PM

    • State changed from “hold” to “wontfix”

    Going to mark this as won't fix. We're open to unofficially supporting this in the Forge, however; Feel free to begin a discussion on the google group. Sure people will jump in if it's something people want.

    But unless we can provide a cross-browser solution we can't claim to support this.

  • moowee

    moowee April 12th, 2011 @ 04:34 AM

    whoa this is really a big help in accessing data. I can easily put data into a new custom namespace. Namespace really help me to prevent element name collisions.

    | essay service

Create your profile

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

Shared Ticket Bins

Pages