GithubHelp home page GithubHelp logo

Comments (5)

ckirkendall avatar ckirkendall commented on July 28, 2024

Can you post the code that returns nill on .-innerHTML? That seems like something is wrong. That is how I do it in enfocus tests. You might need to pull the nodes out before you can call innerHTML.

from enfocus.

defclass avatar defclass commented on July 28, 2024

Thanks for your reply. deftemplate definition is

(em/deftemplate test-template :compiled "resources/tpl/jsnippet/users.html"
  []
  )

this transforms below can get the html which return by (test-template) invoke,

dess.users> (ef/at "#wrapper" (ef/content (test-template)))

<div id="wrapper">
<div id="dropdown-list">
  <div role="group" class="btn-group">
    <button aria-expanded="false" aria-haspopup="true" data-toggle="dropdown" class="btn btn-xs btn-warning dropdown-toggle" type="button">
      handler
      <span class="caret"></span>
    </button>
    <ul class="dropdown-menu">
      <li><a rel="1" href="#">action1</a></li>
    </ul>
  </div>
</div>
</div>

and (test-template) can return #object[DocumentFragment [object DocumentFragment]]

howerver, (.-innerHTML (test-template) return nil.

I am not sure whether need some other info , please just comment.

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

What browser are you using? Also try this and let me know what you get.

(apply str (for [node (test-template)] (.-innerHTML node))

from enfocus.

defclass avatar defclass commented on July 28, 2024

I have tried for firefox (40.0.3) and opera (Opera 31.0) on linux.

for opera:

(apply str (for [node (test-template)] (.-innerHTML node)))

#object[Error Error: [object DocumentFragment] is not ISeqable]
Error: [object DocumentFragment] is not ISeqable
    at Error (native)
    at cljs.core.seq (http://wc.local/admin/js/admin-main-debug.js:5941:69)
    at cljs.core.pr_str.call.cljs.core.apply.call.iter__21561__auto__ (eval at <anonymous> (http://wc.local/admin/js/admin-main-debug.js:28426:264), <anonymous>:5:40)
    at cljs.core.LazySeq.sval (http://wc.local/admin/js/admin-main-debug.js:9071:122)
    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (http://wc.local/admin/js/admin-main-debug.js:9106:8)
    at Object.cljs.core.seq (http://wc.local/admin/js/admin-main-debug.js:5933:14)
    at Object.cljs.core.bounded_count (http://wc.local/admin/js/admin-main-debug.js:9523:28)
    at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (http://wc.local/admin/js/admin-main-debug.js:9895:23)
    at cljs.core.apply (http://wc.local/admin/js/admin-main-debug.js:9881:30)
    at eval (eval at <anonymous> (http://wc.local/admin/js/admin-main-debug.js:28426:264), <anonymous>:1:106)

for firefox:

(apply str (for [node (test-template)] (.-innerHTML node)))         
#object[Error Error: [object DocumentFragment] is not ISeqable]
No stacktrace available.

It seems give no more other info. Besides, I used :optimizations :simple for :compiler, I am not sure whether this has influence , thanks.

from enfocus.

defclass avatar defclass commented on July 28, 2024

addition:
I noticed your function that definded in enfocus.core-test

(defn by-id [id]
  (.getElementById js/document id))

(by-id "wrapper") return #object[HTMLDivElement [object HTMLDivElement]] , and call (.-innerHTML (by-id "wrapper")) will return :

"\n      <!-- Navigation -->\n      <nav class=\"navbar navbar-default navbar-static-top\" role=\"navigation\" style=\"margin-bottom: 0\">\n        <div class=\"navbar-header\">\n          <button class=\"navbar-toggle\" data-target=\".navbar-collapse\" data-toggle=\"collapse\" type=\"button\">\n            <span class=\"sr-only\">Toggle navigation</span>\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n          </button>\n 
 ....

this string is excatly i want. Maybe #object[HTMLDivElement [object HTMLDivElement]] and #object[DocumentFragment [object DocumentFragment]] is the point ?

from enfocus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.