Skip to content
Permalink
Browse files

Fixed small issue where views would not get inserted after dom was lo…

…aded
  • Loading branch information...
Koen Bok
Koen Bok committed Feb 16, 2013
1 parent 27f5914 commit eaa81c412d89b9e68fa9d3e785517de056838970
Showing with 30 additions and 6 deletions.
  1. +5 −1 build/framer.js
  2. +20 −4 src/views/view.coffee
  3. +5 −1 template/framer.js
@@ -1153,7 +1153,11 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam
};

View.prototype._insertElement = function() {
return document.addEventListener("DOMContentLoaded", this.__insertElement);
if (document.readyState === "complete" || document.readySate === "loaded") {
return this.__insertElement();
} else {
return document.addEventListener("DOMContentLoaded", this.__insertElement);
}
};

View.prototype.__insertElement = function() {
@@ -2,7 +2,7 @@ utils = require "../utils"
_ = require "underscore"

{Frame} = require "../primitives/frame"
{Rotation} = require "../primitives/rotation"
# {Rotation} = require "../primitives/rotation"
{Spring} = require "../primitives/spring"
{EventTypes} = require "../primitives/events"
{EventClass} = require "../primitives/events"
@@ -194,7 +194,18 @@ class View extends Frame
@style.display = "block" if value is true
@style.display = "none" if value is false
@emit "change:visible"


# # Rotation
#
# @define "rotateX"
# get: ->
# @_rotateX or 0
# set: (value) ->
# @_rotateX = value
# @style["opacity"] = value
# @emit "change:opacity"


# Hierarchy

removeFromSuperview: ->
@@ -330,7 +341,12 @@ class View extends Frame
@classes = classes

_insertElement: ->
document.addEventListener "DOMContentLoaded", @__insertElement

# If we are loaded we insert the node immediately, if not we wait
if document.readyState is "complete" or document.readySate is "loaded"
@__insertElement()
else
document.addEventListener "DOMContentLoaded", @__insertElement

__insertElement: =>
document.body.appendChild @_element
@@ -362,7 +378,7 @@ View.Properties = utils.extend Frame.Properties,
clip: true
scale: 1.0
opacity: 1.0
rotation: 0
# rotation: 0
style: null
html: null
class: ""
@@ -1153,7 +1153,11 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam
};

View.prototype._insertElement = function() {
return document.addEventListener("DOMContentLoaded", this.__insertElement);
if (document.readyState === "complete" || document.readySate === "loaded") {
return this.__insertElement();
} else {
return document.addEventListener("DOMContentLoaded", this.__insertElement);
}
};

View.prototype.__insertElement = function() {

0 comments on commit eaa81c4

Please sign in to comment.
You can’t perform that action at this time.