[ALOY-18] Can't create DOM elements without an ID
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-07-19T11:52:03.000+0000 |
Affected Version/s | 2012 Sprint 14 |
Fix Version/s | 2012 Sprint 14 |
Components | Runtime, XML |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Tony Lukasavage |
Created | 2012-05-11T12:53:23.000+0000 |
Updated | 2013-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);
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.
markup elements will use a generated ID when they are not given an ID explicitly