Titanium JIRA Archive
Alloy (ALOY)

[ALOY-6] Generated HTML object tree full of whitespace elements

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
ComponentsXML
Labelsn/a
ReporterTony Lukasavage
AssigneeTony Lukasavage
Created2012-05-18T13:27:17.000+0000
Updated2014-06-22T13:21:17.000+0000

Description

Something is wrong with the html.pegjs grammar for HTML. It is generating loads of unnecessary elements in the generated object tree that will make parsing more difficult and time consuming in terms of performance. here's a snippet of what I'm seeing:
[ { tag: 'html',
    attrs: [],
    body: 
     [ '\n\t',
       { tag: 'head',
         attrs: [],
         body: 
          [ '\n\t\t',
            { tag: 'title',
              attrs: [],
              body: [ 'Declarative UI Master Detail Test' ] },
            '\n\t\t',
            { tag: 'script',
              attrs: [ [ 'src', '/controller/index.js' ] ],
              body: [] },
            '\n\t\t',
            { tag: 'style',
              attrs: [],
              body: [ '\n\t\t#mainWindow {\n\t\t\t-ti-layout: \'vertical\';\n\t\t\t-ti-navBarHidden: true;\n\t\t\t-ti-backgroundColor: \'#00a\';\n\t\t}\n\t\t' ] },
            '\n\t' ] },
       '\n\t',
// and so on....
We need to correct the HTML grammar so that these whitespace elements are no longer included in the generated object tree.

Comments

  1. Tony Lukasavage 2012-05-18

    Details here: [https://github.com/appcelerator/ZipTi/commit/8e1e091f5c5eb0a5c6bdd1c8e9e2da6dd5041ae0](https://github.com/appcelerator/ZipTi/commit/8e1e091f5c5eb0a5c6bdd1c8e9e2da6dd5041ae0)

JSON Source