11 lines
329 B
CoffeeScript
11 lines
329 B
CoffeeScript
App.CssObject = Ember.Object.extend
|
|
pixel_fields: ['width', 'height', 'left', 'top', 'line-height']
|
|
isNumeric: /^[-+]?(\d+|\d+\.\d+)$/
|
|
toString: ->
|
|
ret = ""
|
|
for k, v of JSON.parse(JSON.stringify(@))
|
|
if @pixel_fields.indexOf(k) > -1
|
|
v = "#{v}px" if @isNumeric.test(v)
|
|
ret += "#{k}:#{v};"
|
|
ret
|