Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2767] Titanium.UI.XXX components with font-xxxx properties fail JSLint/crash

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionWon't Fix
Resolution Date2013-07-31T23:23:31.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterJean-Etienne LaVallee
AssigneeIngo Muschenetz
Created2011-04-15T03:28:59.000+0000
Updated2017-03-16T21:14:43.000+0000

Description

Just noticed this when I was attempting to make a zombie Ti.js file for my auto-completion hack in NetBeans using the api.json file for 1.5.1

A number of Ti.UI.XXXX components that have text metrics (button, label, etc.) now have properties like "font-family" and "font-size" in addition to the original "font" property. Problem is that the "-" in the property name is malformed Javascript and blows up both the JSLint pass during compilation (which only gives a warning) and then makes an app that crashes on the first instance of such.

Shouldn't these be JS friendly camel-cased, like fontFamily, fontWeight, fontStyle, etc.?

Thnx,
Etienne

Comments

  1. Stephen Tramer 2011-04-15

    Do we even support these properties? We should probably remove them in favor of font and font.size etc.

  2. vetler (at gmail) 2011-04-15

    The bug here is probably (?) that the documentation is wrong. Take a look at the documentation for label, for instance: http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Label-object"> http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI....

    It claims to have a property like "font-weight", but AFAIK it doesn't? The font weight is set by setting the font property like this:

         font: { fontWeight: 'bold'}
       

    I.e.

       Ti.UI.createLabel({ text: 'foobar', height: 'auto',
                width: 'auto', font: { fontWeight: 'bold'} })
       

    Not only does Label not seem to have the property font-weight, but when setting the font property it's fontWeight.

  3. Paul Dowsett 2011-12-30

    This can probably be closed.
  4. Chris Barber 2013-07-31

    We do not support "font-size", "font-family", etc via the JavaScript API. We do support these in .jss files, but jss support is undocumented.
  5. Lee Morris 2017-03-16

    Closing ticket as the issue won't fix.

JSON Source