Titanium JIRA Archive
Alloy (ALOY)

[ALOY-18] Can't create DOM elements without an ID

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-19T11:52:03.000+0000
Affected Version/s2012 Sprint 14
Fix Version/s2012 Sprint 14
ComponentsRuntime, XML
Labelsn/a
ReporterTony Lukasavage
AssigneeTony Lukasavage
Created2012-05-11T12:53:23.000+0000
Updated2013-05-01T14:56:08.000+0000

Description

Our current method of generating the DOM based on the HTML markup relies totally on the idea that every markup element will have an ID, as found in the generate_dom_source function of zipti.js. We need to be able to create elements in the DOM without specifying an ID. They should still be accessible through the standard DOM methods. Right now, all elements without IDs in the markup end up looking like this in the DOM:
var undefined = $Ti.domDoc().createElement('div');
var undefinedattr1 = $Ti.domDoc().createAttribute('style');
undefinedattr1.setNodeValue("-ti-text:'Content'; color:'#000';");
undefined.setAttributeNode(undefinedattr1);
var undefinedattr2 = $Ti.domDoc().createAttribute('data-ti-api');
undefinedattr2.setNodeValue("Label");
undefined.setAttributeNode(undefinedattr2);
content.appendChild(undefined);

Comments

  1. Russell McMahon 2012-05-11

    I agree that we need to create elements that do not have an id. The id was used in early prototypes before there was a selector engine. There does need to thought about how we manage a non id element lifecycle but it should not be too hard to put something in place.
  2. Tony Lukasavage 2012-06-27

    markup elements will use a generated ID when they are not given an ID explicitly

JSON Source