prototype: Fix Element#readAttribute to work with the 'type' attribute in IE. Closes #8160.

This commit is contained in:
Sam Stephenson 2007-04-28 02:23:26 +00:00
parent d01b0b0668
commit 1886b03d60
3 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,8 @@
*1.5.1_rc3 (April 24, 2007)*
*SVN*
* Fix Element#readAttribute to work with the 'type' attribute in IE. Closes #8160. [Tobie Langel, Wiktor Ihárosi]
*1.5.1_rc3* (April 24, 2007)
* Add Element#childElements as an alias for Element#immediateDescendants. [Tobie Langel]

View File

@ -551,6 +551,7 @@ Element._attributeTranslations = {
Object.extend(this, {
href: this._getAttr,
src: this._getAttr,
type: this._getAttr,
disabled: this._flag,
checked: this._flag,
readonly: this._flag,

View File

@ -216,6 +216,7 @@
<input type="checkbox" id="attributes_with_issues_checked" name="a" checked="checked"/>
<input type="checkbox" id="attributes_with_issues_disabled" name="b" checked="checked" disabled="disabled"/>
<input type="text" id="attributes_with_issues_readonly" name="c" readonly="readonly" value="blech"/>
<input type="date" id="attributes_with_issues_type" value="blech" />
<select id="attributes_with_issues_multiple" name="e" multiple="multiple">
<option>blech</option>
<option>blah</option>
@ -825,7 +826,10 @@
['checked','disabled','readonly','multiple'].each(function(attr){
assertEqual(attr, $('attributes_with_issues_'+attr).readAttribute(attr));
});
assertEqual('date', $('attributes_with_issues_type').readAttribute('type'));
assertEqual('text', $('attributes_with_issues_readonly').readAttribute('type'));
var elements = $('custom_attributes').immediateDescendants();
assertEnumEqual(['1', '2'], elements.invoke('readAttribute', 'foo'));
assertEnumEqual(['2', null], elements.invoke('readAttribute', 'bar'));