in partnership with mediatemple

Ticket #708 (assigned defect)

Opened 5 months ago

Last modified 2 days ago

Element.setText in Safari 2.0.4 standalone not working

Reported by: andras@… Owned by: kamicane
Type: defect Priority: minor
Milestone: Mootools version 1.3 Component: Core
Keywords: Cc:

Description

With Safari 2.0.4 standalone version, nothing happens when I'm using Element.setText("content"), while other browsers sets "innerHTML" well. It seems to me that Safari 2.x just doesn't supports setting the "text" property by setProperty.

Change History

Changed 5 months ago by andras@…

<html>
<head>
<title>bug</title>
<script src="mootools-trunk-1318.js"></script>
<script>

window.onload = function() {

$('content').setText('WORKS WELL');

}

</script>
<head>
<body>
<span id="content">NOT WORKING</span>
</body>
</html>

Changed 5 months ago by anonymous

A possible (but maybe not the best) fix:

Element.Properties.text = {

set: function(value) {

if (Browser.isSafari) {

this.innerHTML = ;
this.appendChild(document.createTextNode(value));

} else {

this.set('text', value);

}

}

};

Changed 4 months ago by eric

I'm experiencing the same issue with setText() - aka textContent - not working on Safari 2.0.4.

The following patch can resolve the issue (tested on Safari 2 and 3):

Index: Element.js
===================================================================
--- Element.js (revision 1344)
+++ Element.js (working copy)
@@ -606,7 +606,7 @@

});


Element.Attributes = new Hash({

- Props: {'html': 'innerHTML', 'class': 'className', 'for': 'htmlFor', 'text': (Browser.Engine.trident) ? 'innerText' : 'textContent'},

+ Props: {'html': 'innerHTML', 'class': 'className', 'for': 'htmlFor', 'text': (Browser.Engine.trident Browser.engine.webkit) ? 'innerText' : 'textContent'},

Bools: ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readonly', 'multiple', 'selected', 'noresize', 'defer'],
Camels: ['value', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 'frameBorder', 'maxLength', 'readOnly', 'rowSpan', 'tabIndex', 'useMap']

});

Changed 4 months ago by eric

Sorry, I repost patch with code formatting:

-	Props: {'html': 'innerHTML', 'class': 'className', 'for': 'htmlFor', 'text': (Browser.Engine.trident) ? 'innerText' : 'textContent'},
+	Props: {'html': 'innerHTML', 'class': 'className', 'for': 'htmlFor', 'text': (Browser.Engine.trident || Browser.engine.webkit) ? 'innerText' : 'textContent'},

Changed 4 months ago by eric

  • priority changed from trivial to major
  • milestone changed from Mootools version 1.3 to Mootools version 1.2

Changed 4 months ago by kamicane

  • owner set to kamicane
  • status changed from new to assigned

Changed 4 days ago by digitarald

  • milestone changed from Mootools version 1.2 to Mootools version 1.3

Changed 2 days ago by tomocchino

  • priority changed from major to minor
  • milestone set to Mootools version 1.3
Note: See TracTickets for help on using tickets.