8000 Can't clone objects created within iframes. · Issue #30 · lukeed/klona · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Can't clone objects created within iframes. #30
Open
@juliofarah

Description

@juliofarah

While testing a tool that uses klona/lite, I realized the library did not clone objects created within iframes.

There's a bigger discussion here about how prototypes are different for similar objects when created in different iframes (or within an iframe versus the top page).

When I create an object within an iframe:
image

this snippet https://github.com/lukeed/klona/blob/master/src/lite.js#L7-L13 is executed, given typeof x.constructor === 'function' and not object when the object is created within an iframe.

Line 10 though checks if the property already exists on the temporary object, which is empty, ignoring the property I'm trying to clone.

I got around the problem by switching from klona/lite to klona/full as the latter doesn't include that constructor check, but I'd love to switch back to shave those extra few bites off of my final bundle

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0