I like "The Magic Numbers", but only on CD, not in my code. So +1 to
replace them with constants.

On 21/02/07, Tom Gregory <[EMAIL PROTECTED]> wrote:
>
> On Feb 21, 2007, at 2:56 PM, Mislav Marohnić wrote:
>
> > Also, what about that Safari text-node event target thing? Should
> > we have a fix for that also?
> >
>
> Isn't that as easy as updating Event.element(), or am I missing
> something?
>
> i.e.
>    element: function(event) {
> +    var e = event.target || event.srcElement;
> +    return (e.nodeType == 3) ? e.parentNode : e;
> -    return event.target || event.srcElement;
>    },
>
>
>
> On a similar but slightly unrelated note, could/should Prototype
> handle IE's lack of implementation for the Node constants?  This
> would allow Prototype to not use "magic numbers" when checking node
> types, but a human-readable constant string?
>
> http://www.w3.org/TR/DOM-Level-2-Core/ecma-script-binding.html
>
> if (typeof Node == "undefined") {
>         var Node = new Object();
>         Object.extend (Node, {
>                 ELEMENT_NODE: 1,
>                 ATTRIBUTE_NODE: 2,
>                 TEXT_NODE: 3,
>                 CDATA_SECTION_NODE: 4,
>                 ENTITY_REFERENCE_NODE: 5,
>                 ENTITY_NODE: 6,
>                 PROCESSING_INSTRUCTION_NODE: 7,
>                 COMMENT_NODE: 8,
>                 DOCUMENT_NODE: 9,
>                 DOCUMENT_TYPE_NODE: 10,
>                 DOCUMENT_FRAGMENT_NODE: 11,
>                 NOTATION_NODE: 12
>         });
> }
>
>
> Thus,
>
> $('someEl').nodeType == 3
>
> becomes
>
> $('someEl').nodeType == Node.TEXT_NODE
> >
>


-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to