[ 3 posts ]

Alex Xiao

  • Username: alexx
  • Joined: Mon Jun 04, 2012 2:44 pm
  • Posts: 3
  • Offline
  • Profile

hasPlugin and set/getData working across sandboxes

Post Posted: Mon Jun 04, 2012 3:59 pm
+0-
Hi,
I found out the set/getData methods are only valid in one sandbox, once you create another one, you cannot get data you set to the previous sandbox. So set/getData is not working across different sandboxes. See the example I created at jsfiddle:http://jsfiddle.net/pV8WA/2/

What I really want is, if I apply my plugin to a node, when the second time I try to apply it, I should be able to detect whether this node already has the plugin or not. Therefore, my orignal idea was to setData to this node when first apply the plugin, then, when second time if I can getData from this node, I will know this node has already got the plugin that I don't need to apply to it anymore. Currently, I can use set/getAttribute to a DOM element and make it works. But I prefer to hide this information and use set/getData to a node object.

According to the example I created above, set/getData doesn't work across sandboxes, I sort of understand why. But is it a bug or how can I get around with this problem?

Thanks

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: hasPlugin and set/getData working across sandboxes

Post Posted: Mon Jun 11, 2012 1:19 pm
+0-
It's not a bug, it's by design. Sandboxes should not share data between them. So one sandbox reading the data from a Node belonging to another sandbox violates that sandbox.

Alex Xiao

  • Username: alexx
  • Joined: Mon Jun 04, 2012 2:44 pm
  • Posts: 3
  • Offline
  • Profile

Re: hasPlugin and set/getData working across sandboxes

Post Posted: Tue Jun 12, 2012 3:01 pm
+0-
Thanks
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron