[TIMOB-7968] iOS: Replace Node.text with Node.textContent
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-03-18T11:08:14.000+0000 |
| Affected Version/s | Release 2.0.0 |
| Fix Version/s | Release 2.0.0, Sprint 2012-06 |
| Components | iOS |
| Labels | qe-port |
| Reporter | Marshall Culpepper |
| Assignee | Max Stepanov |
| Created | 2012-03-12T20:50:28.000+0000 |
| Updated | 2012-08-16T04:03:14.000+0000 |
Description
For MobileWeb parity in 2.0, we need to deprecate the current
Node.text property in our XML API, and rename it to textContent. We won't be fully implementing textContent from the DOM3 spec as it requires read-write access, and the traversal rules are slightly different than our current implementation. This is mainly for source level equivalence, until we have time to implement it properly.
var win1 = Titanium.UI.createWindow({ title: 'Window', backgroundColor: '#fff'}); var label1 = Titanium.UI.createLabel({ color: '#999', text: '', textAlign: 'center', width: 'auto'}); win1.add(label1); var xhr = Titanium.Network.createHTTPClient(); xhr.onerror = function(e) { Ti.API.error('Error received while requesting library data: ' + JSON.stringify(e)); }; xhr.onload = function() { if (this.readyState == 4) { var xmldoc = this.responseXML.documentElement; Ti.API.info('Loaded'); label1.text = 'Text: ' + xmldoc.getElementsByTagName('body').item(0).textContent; } }; xhr.open('GET', 'http://www.w3schools.com/xml/note.xml'); xhr.send(); win1.open();Please make sure that we have both text and textContent available but text is marked deprecated.
Pull request #1676 merged
Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120815194913 Tested with Titanium Studio: 2.1.1.201207271312 Device - iOS 5.1 simulator Machine OS - MAC 10.7.3