Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9071] iOS: getAttributeNS and createAttributeNS Don't Accept Null First Argument

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-05-10T16:36:25.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.0.2, Release 2.1.0, Sprint 2012-10 API
ComponentsiOS
Labelsapi, module_xml, qe-testadded
ReporterDawson Toth
AssigneeVishal Duggal
Created2012-05-09T10:56:02.000+0000
Updated2013-12-10T06:03:00.000+0000

Description

Problem

On iOS, getAttributeNS doesn't accept a null first argument. It requires a string. This isn't consistent with browser behavior, which accepts a null value. The same applies to createAttributeNS.

Expected Behavior

Calling getAttributeNS with null as the first argument should behave identically to getAttribute. The same applies to createAttributeNS.

Reproduction

var xmlDoc = Ti.XML.parseString('<html><head></head><body><a href="http://appcelerator.com/" /></body></html>');
var anchor = xmlDoc.getElementsByTagName('a').item(0);
try {
    alert(anchor.getAttributeNS(null, 'href'));
}
catch (err) {
    alert('FAIL: getAttributeNS: ' + err);
}
try {
    alert(xmlDoc.createAttributeNS(null, 'id'));
}
catch (err) {
    alert('FAIL: createAttributeNS: ' + err);
}

Comments

  1. Vishal Duggal 2012-05-09

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/2162
  2. Natalie Huynh 2012-05-14

    Tested with 2.0.2.v20120514121649 on iPhone 4 5.0.1 (need to add var win = TI.UI.createWindow(); when building to device)
  3. Shameer Jan 2013-12-10

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5039

JSON Source