prototype: Fix Element#writeAttribute to work with 'cellspacing' and 'cellpadding' attributes in IE. Closes #9983.

This commit is contained in:
Tobie Langel 2008-01-23 12:17:26 +00:00
parent 02cc9992e9
commit b26f4e349e
3 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,7 @@
*SVN*
* Fix Element#writeAttribute to work with 'cellspacing' and 'cellpadding' attributes in IE. Closes #9983. [/dev/urandom, Tobie Langel]
* Prevent a potential security issue for cross-site ajax requests. [Alexey Feldgendler, sam, Tobie Langel]
* Test for attribute existence before applying more complex CSS3 selectors. Closes #10870. [arty, Tobie Langel]

View File

@ -799,7 +799,10 @@ else if (Prototype.Browser.IE) {
};
Element._attributeTranslations.write = {
names: Object.clone(Element._attributeTranslations.read.names),
names: Object.extend({
cellpadding: 'cellPadding',
cellspacing: 'cellSpacing'
}, Element._attributeTranslations.read.names),
values: {
checked: function(element, value) {
element.checked = !!value;

View File

@ -281,7 +281,7 @@
</select>
</form>
<table id="write_attribute_table">
<table id="write_attribute_table" cellpadding="6" cellspacing="4">
<tr><td id="write_attribute_td">A</td><td>B</td></tr>
<tr><td>C</td></tr>
<tr><td>D</td><td>E</td><td>F</td></tr>
@ -1313,6 +1313,10 @@
var elements = $('custom_attributes').immediateDescendants();
assertEnumEqual(['1', '2'], elements.invoke('readAttribute', 'foo'));
assertEnumEqual(['2', null], elements.invoke('readAttribute', 'bar'));
var table = $('write_attribute_table');
assertEqual('4', table.readAttribute('cellspacing'));
assertEqual('6', table.readAttribute('cellpadding'));
}},
testElementWriteAttribute: function() {with(this) {
@ -1363,6 +1367,12 @@
assertEqual('some-other-id', label.writeAttribute({htmlFor: 'some-other-id'}). readAttribute('for'));
assert(p.writeAttribute({style: 'width: 5px;'}).readAttribute('style').toLowerCase().include('width'));
var table = $('write_attribute_table');
table.writeAttribute('cellspacing', '2')
table.writeAttribute('cellpadding', '3')
assertEqual('2', table.readAttribute('cellspacing'));
assertEqual('3', table.readAttribute('cellpadding'));
}},
testElementWriteAttributeWithCustom: function() {with(this) {