This project is archived and is in readonly mode.

#32 ✓resolved
Thomas Aylott

Element.setText in Safari 2.0.4 standalone not working

Reported by Thomas Aylott | May 28th, 2008 @ 10:05 AM | in 1.2.1

Originally posted on Trac by andras@…

Original Trac Ticket

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.

Trac Attachments

Trac Comments

Changed 5 months ago by andras@…



bug 

window.onload = function() { 

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

} 

NOT WORKING 

      

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



                  Changed 4 months ago by eric

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

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

Changed 4 months ago by kamicane



                  Changed 4 months ago by kamicane

          owner
              set to kamicane
        
          status
              changed from new to assigned

          owner
              set to kamicane
        
          status
              changed from new to assigned
        
      

Changed 2 weeks ago by digitarald



                  Changed 2 weeks ago by digitarald

          milestone
              changed from Mootools version 1.2 to Mootools version 1.3

          milestone
              changed from Mootools version 1.2 to Mootools version 1.3
        
      

Changed 2 weeks ago by tomocchino



                  Changed 2 weeks ago by tomocchino

          priority
              changed from major to minor
        
          milestone
              set to Mootools version 1.3

          priority
              changed from major to minor
        
          milestone
              set to Mootools version 1.3
        
      

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Tags

Pages