Module: Browser::NativeCachedWrapperClassMethods
- Defined in:
- opal/browser/utils.rb
Instance Method Summary collapse
Instance Method Details
permalink #new(native) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'opal/browser/utils.rb', line 53 def new(native) # We can't access arbitrary properties if an element is restricted # i.e. the DOM element is an item we can't fully access due to CORS. if restricted?(native) # Let's try to bypass any further initializers... may be ugly, but # works. obj = allocate obj.instance_variable_set :@native, native obj.instance_variable_set :@restricted, true return obj end # It's not a native element? Weird, better throw an exception. raise ArgumentError if !native?(native) if defined? `#{native}.$$opal_native_cached` `#{native}.$$opal_native_cached` else `#{native}.$$opal_native_cached = #{super(native)}` end end |