Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7968] iOS: Replace Node.text with Node.textContent

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-03-18T11:08:14.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsiOS
Labelsqe-port
ReporterMarshall Culpepper
AssigneeMax Stepanov
Created2012-03-12T20:50:28.000+0000
Updated2012-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.

Comments

  1. Max Stepanov 2012-03-14

       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();
       
  2. Neeraj Gupta 2012-03-14

    Please make sure that we have both text and textContent available but text is marked deprecated.
  3. Blain Hamon 2012-03-18

    Pull request #1676 merged
  4. Shyam Bhadauria 2012-08-16

    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

JSON Source