Ticket #6465: crossbrowser_innertext.diff
| File crossbrowser_innertext.diff, 2.4 kB (added by Caged, 3 years ago) |
|---|
-
test/unit/dom.html
old new 47 47 <div id="testlog"> </div> 48 48 49 49 <div> 50 <table >50 <table id="atable"> 51 51 <tbody id="table"> 52 52 <tr> 53 53 <td>Data</td> … … 62 62 </table> 63 63 </div> 64 64 65 <table> 66 <tr> 67 <td id="another_cell">This is a cell</td> 68 <td id="cell_script">This is <script>var i = 'some string'; </script> some inner text</td> 69 </tr> 70 </table> 71 65 72 <p class="test">Test paragraph outside of container</p> 66 73 67 74 <div id="container"> … … 551 558 elem.scrollTo(); 552 559 assertEqual(Position.page(elem)[1], 0); 553 560 window.scrollTo(0, 0); 561 }}, 562 563 testInnerTextEmulation: function() {with(this) { 564 var cell = $('another_cell'); 565 $('testdiv').innerText = 'javascript loves prototype'; 566 assertEqual('javascript loves prototype', $('testdiv').innerText); 567 assertEqual('This is a cell', cell.innerText); 568 cell.innerText = 'some inner text'; 569 assertEqual('This is some inner text', $('cell_script').innerText); 570 assertEqual('some inner text', cell.innerText); 554 571 }} 555 572 556 573 }, 'testlog'); -
src/prototype.js
old new 3 3 var Prototype = { 4 4 Version: '<%= PROTOTYPE_VERSION %>', 5 5 BrowserFeatures: { 6 XPath: !!document.evaluate 6 XPath: !!document.evaluate, 7 textContent: !!(typeof HTMLElement != 'undefined' && 8 typeof HTMLElement.prototype.__defineGetter__ == 'function') 7 9 }, 8 10 9 11 ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', -
src/dom.js
old new 20 20 } 21 21 } 22 22 23 if(Prototype.BrowserFeatures.textContent) { 24 HTMLElement.prototype.__defineGetter__("innerText", function () { 25 return this.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' '); 26 }); 27 28 HTMLElement.prototype.__defineSetter__('innerText', function(text) { 29 this.textContent = text; 30 }); 31 } 32 33 23 34 document.getElementsByClassName = function(className, parentElement) { 24 35 if (Prototype.BrowserFeatures.XPath) { 25 36 var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";