Error: Assertion failed in FF 31 when used with AngularJS

292 views
Skip to first unread message

Sébastien Cevey

unread,
Aug 1, 2014, 9:31:12 AM8/1/14
to polym...@googlegroups.com
I've been getting errors when trying to load platform.js (0.3.4) in an AngularJS (1.2.19 or 1.3.*) application. I'm finding it hard to track it down precisely because I couldn't find an unminimised platform.js source and FF doesn't seem to pick up the source map of the minimised one, but I've copied the stack trace below.

My suspicion is that it may somehow be related to some kind of polyfill injected on `appendChild`/`insertBefore`? It works perfectly fine in Chrome 37.

I've created a reduced test case here: http://jsbin.com/roxif/2/edit

You can see the error in the console.

Any help would be very much appreciated!



--
Sébastien Cevey
Software Developer


Visit theguardian.com. On your mobile and tablet, download the Guardian iPhone and Android apps theguardian.com/guardianapp and our tablet editions theguardian.com/editions.  Save up to 57% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access.  Visit subscribe.theguardian.com

This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way.  Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.
 
Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP.  Registered in England Number 908396


Rob Dodson

unread,
Aug 1, 2014, 9:41:15 AM8/1/14
to Sébastien Cevey, polym...@googlegroups.com
Try changing your javascript to this:

angular.bootstrap(wrap(document), ['test']);

To Polyfill Shadow DOM we wrap the native DOM nodes and update their methods to respect shadow boundaries. Some nodes, like document, window, document.body, document.head, cannot be overridden so you have to wrap them yourself and use the returned value. One good trick is to throw everything into an immediately invoked function like this:

(function(document) {
  
// do all your stuff in here

})(wrap(document));

More in-depth explanation of wrappers can be found here: http://www.polymer-project.org/platform/shadow-dom.html#wrappers

Hope that helps!


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CALft9sTmw9FhQUd6w3nOSYyMLg3O%2Btd-bWJXF_JRZ5fMchB5PQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Sébastien Cevey

unread,
Aug 1, 2014, 2:25:50 PM8/1/14
to Rob Dodson, polym...@googlegroups.com
Fantastic, that seems to have done it. Thanks a lot Rob!

PS: I haven't traced through the code, but I wonder if the error could hint at this solution?
Reply all
Reply to author
Forward
0 new messages