Here's maybe a bit more insight into why evaluating Polymer(...) gives "TypeError: Polymer is not a function". This is confusing, because *i)* the Polymer() function / object is definitely available in all browser js consoles. *ii)* And even calling Polymer() in Chrome fails. But if I first import this:
<link rel="import" href="bower_components/polymer/polymer.html"> *A)* Then I can call Polymer() in Chrome (and Opera). However, I need to call Polymer.__proto__.constructor() in Firefox and Safari. Looks like others have wrestled with this <https://github.com/addyosmani/componentized-todo/pull/1> too. So it seems the Chrome family of browsers have some extra shims and code to handle Polymer objects. Firefox and Safari are close, but are somehow unable to call Polymer directly, without reaching into the __proto__.constructor. *B)* I also tried waiting for the *polymer-ready* event <https://www.polymer-project.org/docs/polymer/polymer.html#polymer-ready> before manipulating any of the DOM or setting CoreStyle properties (to no avail). Obviously I don't need to do this on Chrome, because native HTML imports work a little differently. But definitely not on Firefox or any browser without native HTML imports (see here <http://stackoverflow.com/questions/26555304/my-polymer-website-does-not-work-on-firefox> ). *C)* And remember that it's each component, trying to instantiate itself, that throws the error. (function() { Polymer('*core-toolbar*', { ... } ) } ) // calling the Polymer function is what throws the error. Hth Tim Washington Interruptsoftware.com <http://interruptsoftware.com> On Fri, Dec 19, 2014 at 11:53 AM, Timothy Washington <[email protected]> wrote: > > Ah, shoot. Ok, so I've released bkell 0.1.0 to clojars (SNAPSHOT got > trampled) (see here <https://clojars.org/bkell/versions/0.1.0> and here > <https://clojars.org/repo/bkell/bkell/0.1.0/>). So just change that. > > As far as javascript creating Polymer elements, theoretically, there > shouldn't be a problem. If I can call `document.createElement("fubar")`, > then I should be able to call ` > document.createElement("my-custom-component")` . For example, these work > in Chrome, Firefox and Safari. > > document.createElement("div") > <div></div> > > document.createElement("fubar") > <fubar></fubar> > > document.createElement("my-custom-component") > <my-custom-component></my-custom-component> > > document.createElement("core-header-panel") > <core-header-panel></core-header-panel> > > > > Tim Washington > Interruptsoftware.com <http://interruptsoftware.com> > > > On Fri, Dec 19, 2014 at 11:11 AM, Aaron Craelius <[email protected]> > wrote: >> >> Also, have you verified in these browsers that you can create Polymer >> elements using Javascript - i.e. document.createElement(...)? >> >> On Fri, Dec 19, 2014 at 11:01 AM, Aaron Craelius <[email protected] >> > wrote: >>> >>> Okay, missing a dependency: >>> Could not find artifact bkell:bkell:jar:0.1.0-SNAPSHOT in clojars ( >>> https://clojars.org/repo/) >>> >>> On Fri, Dec 19, 2014 at 10:39 AM, Timothy Washington <[email protected] >>> > wrote: >>>> >>>> Sure thing. Go to the *feature-state-management* branch of this github >>>> repo >>>> <https://github.com/twashing/bkeeping/tree/feature-state-management>. >>>> >>>> Clone it, and run `*lein ring server-headless*`. Then go to ` >>>> *localhost:3000/landing.html*` in your browser. For me, it works in >>>> Chrome, but fails in Firefox and Safari. All polymer components should >>>> be >>>> <https://github.com/twashing/bkeeping/tree/feature-state-management/resources/public/bower_components> >>>> on your file system. Let me know if you have any problems. >>>> >>>> >>>> Tim Washington >>>> Interruptsoftware.com <http://interruptsoftware.com> >>>> >>> -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
