From b26f4e349e35c4913eb72621b522bfd6363c394f Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Wed, 23 Jan 2008 12:17:26 +0000 Subject: [PATCH] prototype: Fix Element#writeAttribute to work with 'cellspacing' and 'cellpadding' attributes in IE. Closes #9983. --- CHANGELOG | 2 ++ src/dom.js | 5 ++++- test/unit/dom.html | 12 +++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cd5bdb2..10410b8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/src/dom.js b/src/dom.js index 3db2992..e0a3c2c 100644 --- a/src/dom.js +++ b/src/dom.js @@ -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; diff --git a/test/unit/dom.html b/test/unit/dom.html index 0828ad5..ab64a46 100644 --- a/test/unit/dom.html +++ b/test/unit/dom.html @@ -281,7 +281,7 @@ - +
@@ -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) {
AB
C
DEF