[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-13 Thread Tobie Langel

Great jobs guys... unit tests would make it even better!

Best,

Tobie


On Feb 13, 12:22 am, John-David Dalton [EMAIL PROTECTED]
wrote:
 http://dev.rubyonrails.org/ticket/11092
 updated the ticket with an alternative fix which works for everything
 except
 child elements with duplicate id's.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-13 Thread John-David Dalton

A two parter:

1) Would that mean t modifying he dom.html unit test to test for this?


2) I ran the unit test with prototype 1.6.0.2 downloaded from
prototypejs.org and in each browser diff tests fail.
Does this mean that there are issues with the current code base that
are still needing to be resolved?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-13 Thread John-David Dalton

I suspect the unit tests are tailered for the current revision in
svn..
time for me to dload rails... or manually compile me some js.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-13 Thread Tobie Langel

1) yes, well, at least, adding the necessary code and maybe html.

2) make sure you build Prototype before running the tests (use rake
dist or run the tests from rake using rake test which auto build
Prototype). Currently all tests pass in all supported browsers except
a coouple of known issues in Opera. Note that the ajax tests are emant
to be run from rake.

On Feb 13, 2:33 pm, John-David Dalton [EMAIL PROTECTED]
wrote:
 A two parter:

 1) Would that mean t modifying he dom.html unit test to test for this?

 2) I ran the unit test with prototype 1.6.0.2 downloaded from
 prototypejs.org and in each browser diff tests fail.
 Does this mean that there are issues with the current code base that
 are still needing to be resolved?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-13 Thread John-David Dalton

Rock!

Updated the ticket, passes the dom.html unit test with flying colors.
Also added a modified unit test that contains tests for this ticket.

The files of importance are
ie_attrib_patch.diff
dom.html

http://dev.rubyonrails.org/ticket/11092
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread John-David Dalton

i will ass ^ $
no need to go looping
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread John-David Dalton

this patch doesn't solve the issue entirely
if you have a child element with the id=parentNode
and the parent element tries element.parentNode it will return the
child with the id parentNode.

bummer.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread John-David Dalton



http://dev.rubyonrails.org/ticket/11092
updated the ticket with an alternative fix which works for everything
except
child elements with duplicate id's.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread John-David Dalton

woopsie *add, and ticket updated thanks Ken!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread Ken Snyder

John-David Dalton wrote:
 ticket + patch for the bug:
 http://dev.rubyonrails.org/ticket/11092
   
Spiffy use of clone. Won't the line /name|id/.test(name) catch 
attributes such as myid?  Would ['name', 'id'].include(name) be 
better? Or you could just add ^ and $.

- Ken

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread John-David Dalton

ticket + patch for the bug:
http://dev.rubyonrails.org/ticket/11092
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread Doctuh

No I take that back, I think identity is susceptible to the same
problem.

On Feb 12, 12:42 pm, Doctuh [EMAIL PROTECTED] wrote:
 Something I forgot to add: using the .identify() method on the form
 avoids this problem entirely.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread Jon L.

You may be better treating id as a property (or, elem.id) vs.
attribute.
'id' isn't a member of the attributes object in FF; which, I'd assume,
has at least some influence on getAttribute (maybe not).

- Jon L.


On Feb 12, 1:16 pm, Ken Snyder [EMAIL PROTECTED] wrote:
 Doctuh wrote:
  ...

  form id=foo
   input type=hidden name=id' value=bar /
  /form

  If you have a form with a hidden form element named 'id', and you try
  to use readAttribute() on the form you will get two different
  responses:

  IE gives you an Object (the input object named 'id')
  Firefox gives you 'foo'.

  IE will give you 'foo' if there is not a overriding form element.

  ...

 I can confirm that using element.id, element.readAttribute('id'), and
 element.getAttribute('id') will always return the same thing as the most
 explicit form-element access: document.forms[0].elements['id'];  In
 fact, foo doesn't seem to be a value for any attribute of the form
 node--when I iterate through the properties of the foo form, for
 example, the text foo does not show up anywhere.  I don't know of any
 function besides getAttribute that should return it.  Somehow the 'id'
 node (the hidden input) in the form's elements collection overwrites the
 form node id.

 I don't know if there is a good way to normalize this behavior for IE
 without checking for a form tag and using something hackish like a regex
 on outerHTML. For example, the code below uses outerHTML and works at
 least for the case you provided.

 - Ken Snyder

 Element.addMethods('form', {
   readAttribute: function(element, name) {
 element = $(element);
 if (Prototype.Browser.IE) {

   // begin new section
   if (typeof element[name] == 'object') {
 var match = new RegExp(RegExp.escape(name) + '=([^
  ]+)').exec(element.outerHTML);
 if (match) return match[1];
   }
   // end new section

   var t = Element._attributeTranslations.read;
   if (t.values[name]) return t.values[name](element, name);
   if (t.names[name]) name = t.names[name];
   if (name.include(':')) {
 return (!element.attributes || !element.attributes[name]) ? null :
  element.attributes[name].value;
   }
 }
 return element.getAttribute(name);
   }

 });
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Prototype-core] Re: readAttribute() differences IE and Firefox

2008-02-12 Thread Doctuh

Something I forgot to add: using the .identify() method on the form
avoids this problem entirely.

On Feb 12, 12:37 pm, Doctuh [EMAIL PROTECTED] wrote:
 My first post. This is to document a tricky thing I found while using
 Element.readAttribute() on a form. This post is to help the next
 person looking for an answer on it.

 ex:

 form id=foo
  input type=hidden name=id' value=bar /
 /form

 If you have a form with a hidden form element named 'id', and you try
 to use readAttribute() on the form you will get two different
 responses:

 IE gives you an Object (the input object named 'id')
 Firefox gives you 'foo'.

 IE will give you 'foo' is there is not a overriding form element.

 I did not expect this, thinking that readAttribute would be
 normalizing these behaviors, but IE sigh.
 This tied me up for a little while.  Thanks to jdalton and tobie on
 FreeNode for the help.

 -

 Internet Explorer IE Firefox FF Element.readAttribute()
 readAttribute() String [object]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---