Titanium JIRA Archive
Alloy (ALOY)

[ALOY-16] There's no way to specify complex types in markup for UI properties

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-19T11:52:02.000+0000
Affected Version/s2012 Sprint 14
Fix Version/s2012 Sprint 14
ComponentsRuntime, XML
Labelsn/a
ReporterTony Lukasavage
AssigneeTony Lukasavage
Created2012-05-11T13:46:19.000+0000
Updated2012-07-19T11:52:02.000+0000

Description

Description

ZipTi currently provides no means of specifying complex types in CSS, therefore there is no way of specifying many common UI properties from markup. This will cause some major confusion, not to mention that it is contrary to the point of abstracting styling through CSS. This effects some of our most used properties, like font.

Example

<html>
  <body>
    <div id="label1" data-ti-api="Label" style="font:{fontSize:30}"></div>
  </body>
</html>
Will cause the following cryptic error to appear, as a result of the CSS-compliant grammar and parser used for parsing:
Uncaught SyntaxError: Expected "+", "-", angle, frequency, function, hash, identifier, 
length, number, percentage, string, time, uri or whitespace but "{" found.

Comments

  1. Russell McMahon 2012-05-11

    I think the way to handle this is to look at the complex properties that make up a majority of the Ti.UI namespace like Point, Font, and Array. For Array only simple types like strings or numbers should be supported. They map to CSS style using the shorthand syntax for example: -ti-font: 'Helvetica' '12px' 'italic' 'bold'; or -ti-fontFamily: 'Helvetica'; -ti-fontSize: '12px'; -ti-fontStyle: 'italic'; -ti-fontWeight: 'bold';
  2. Tony Lukasavage 2012-05-14

    Should we create a ticket/story for documenting all of these cases? This likely will be a difficult task, especially considering that some won't have a direct correlation in CSS.
  3. Tony Lukasavage 2012-06-06

    We have swicthed from CSS styling to JSON, so this is no longer an issue.

JSON Source