Giter Club home page Giter Club logo

Comments (29)

dbushenko avatar dbushenko commented on July 28, 2024

The same. Switching to alpha1 breaks the compilation:

Compiling "resources/public/js/main.js" failed:
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: cljs.compiler/resolve-var, compiling:(domina/macros.clj:13)

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

@dbushenko @robert-stuttaford quick question what version of clojurescript are you compiling against. If you are using cljsbuild what version also?

from enfocus.

robert-stuttaford avatar robert-stuttaford commented on July 28, 2024

I am using:

Clojurescript 0.0-1443
cljsbuild 0.2.4

On 7 August 2012 15:31, Creighton Kirkendall [email protected]:

@dbushenko https://github.com/dbushenko @robert-stuttafordhttps://github.com/robert-stuttafordquick question what version of clojurescript are you compiling against. If
you are using cljsbuild what version also?


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-7553199.

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

Fails also with cljsbuild 0.2.5 :-(

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

This looks like a clojure version issue. The only way I have gotten things to work was to drop back to cljsbuild 0.2.1. I believe it is an issue with some things depending on clojure 4 and others clojure 3. I will try to work out exactly what the issue is and fix it but it may take a day or two.

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

@robert-stuttaford @dbushenko I update enfocus to be dependent on clojure 1.4 and domina 1.0.0. This seems to have fixed the issue. Can you point your projects to 1.0.0-SNAPSHOT and let me know if the issue is resolved.

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

@ckirkendall, I have tested your solution, and it really fixes the compile problem. But unfortunately, it still does not work for me as it breaks compatibility with my previous code. Although my code compiles (with lots (!) of warnings), it does not work on Google Chrome now. I don't know why, but it just doesn't. Without any errors or warnings. It works on firefox, so I couldn't catch the issue with Firebug.

This really bothers me since I use enfocus for a small startup and target just three browsers: Safari, Firefox and Chrome. I was really happy with the functionality of enfocus 0.9.1, it looked for me as stable enough. Looks like the integration of enfocus with domina made this union a bit fragile.

May be you could make a branch for 0.9.1 fixing a couple of errors and releasing it as a long-time support while developing integration with domina as an experimental branch?

UPD: The error within the js-console of Chrome looks like this:
TypeError: Cannot call method 'call' of undefined

Also I have found out that some of the functionality works, and some -- not. Probably, the issue is somewhere in Domina which possibly doesn't support some of the syntax.

from enfocus.

robert-stuttaford avatar robert-stuttaford commented on July 28, 2024

It compiles and it runs! :-)

Great job, Creighton!!

Is there a chance "enfocus.core.debug" can be false, by default, please? My poor console!

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

@robert-stuttaford oops, yes it should be false. Will fix.

from enfocus.

robert-stuttaford avatar robert-stuttaford commented on July 28, 2024

It also appears that click event handlers are now getting goog.events.BrowserEvent events with no currentTarget or target values.

I have a nav where I read data-* attributes out of (.-currentTarget e) to determine where to navigate to. This was definitely working in 0.9.1.

What's interesting is that your debug output is displaying the node I was expecting to see in currentTarget right after the event handler is done.

I'm on #clojure as ro_st if you want to go interactive :-)

Edit: weird. Even though Chrome Dev Tools doesn't display the currentTarget, my code that uses it seems to work fine. Curious.

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

@dbushenko I will certainly support the 0.9.1 branch release until we can work out the kinks in the alpha branch. Both Luke(domina) and I do a lot of testing on different browser and I am sort of shocked that Chrome was an issue, given its my browser of choice. Can you do me a favor before you swing back to the 0.9.1 branch? The console in Chrome gives you line numbers and will jump you to the js code. Can you send me the line of javascript code that threw the type error. Also what features exactly did you see issues with?

On the warnings these are caused by Luke's use of protocols and I believe after looking at the code that the bug is in the warning code and not in Lukes code.

Sorry for your issues and thank you for helping diagnosis some stuff.

CK

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

When I get into work I will hop on IRC. I am very confused by the
currentTarget issue. I didn't change the event code and I use
(.-currentEvent e) extensively in my test cases.

CK

On Wed, Aug 8, 2012 at 7:48 AM, Robert Stuttaford
[email protected]:

It also appears that click event handlers are now getting
goog.events.BrowserEvent events with no currentTarget or target values.

I have a nav where I read data-* attributes out of (.-currentTarget e) to
determine where to navigate to. This was definitely working in 0.9.1.

What's interesting is that your debug output is displaying the node I was
expecting to see in currentTarget right after the event handler is done.

I'm on #clojure as ro_st if you want to go interactive :-)


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-7581406.

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

@ckirkendall thanks for supporting 0.9.1!
I'll send you more detailed bugreport on 1.0.0-snapshot in a few hours, after I get home.

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

@ckirkendall

This is the stacktrace from Chrome:

Uncaught TypeError: Cannot call method 'call' of undefined
attendee_header main.js:31699
add_attendee_header main.js:31717
common.post_data.call.common.make_post_data.call.cljs.core.ObjMap.fromObject.ï·�'search-name main.js:31738
(anonymous function)main.js:31661
goog.events.Listener.handleEvent main.js:22504
goog.events.fireListener main.js:23003
goog.events.fireListeners_ main.js:22992
goog.events.dispatchEventmain.js:23057
goog.events.EventTarget.dispatchEventmain.js:23187
goog.net.XhrIo.dispatchEventmain.js:27499
goog.net.XhrIo.onReadyStateChangeHelper_main.js:27591
goog.net.XhrIo.onReadyStateChangeEntryPoint_main.js:27571
goog.net.XhrIo.onReadyStateChange_

This is the line which caused error:
enfocus.core.i_at.call(null, id_sym21988__21997, pnod21989__21999);

The function attendee-header looks like this:

(em/defsnippet attendee-header "/html/snippets.html" [":#search-results-header"] [])

the compiled JS function:

common.attendee_header = function attendee_header() {
var vec__21995__21996 = function() {
return enfocus.core.get_cached_snippet.call(null, "/html/snippets.html", cljs.core.PersistentVector.fromArray([":#search-results-header"], true))
}.call(null);
var id_sym21988__21997 = cljs.core.nth.call(null, vec__21995__21996, 0, null);
var pnod21989__21998 = cljs.core.nth.call(null, vec__21995__21996, 1, null);
var pnod21989__21999 = enfocus.core.create_hidden_dom.call(null, pnod21989__21998);
enfocus.core.i_at.call(null, id_sym21988__21997, pnod21989__21999);
Uncaught TypeError: Cannot call method 'call' of undefined
enfocus.core.reset_ids.call(null, id_sym21988__21997, pnod21989__21999);
return enfocus.core.remove_node_return_child.call(null, pnod21989__21999)
};

The html-file from which I build the snippet:

< !DOCTYPE html>
< html lang="en">
< head>
< body>
< table id="search-results" class="box-table-a">
< tr id="search-results-header">
< th class="results-table-name-col-head box-table-a-leftcorner">Name
< th class="results-table-status-col-head box-table-a-rightcorner">Attendancies
< /tr>
< tr class="search-results-row" id="search-results-row" style="cursor:pointer;cursor:hand;">
< td id="search-results-row-name" class="results-table-name-col">
< td id="search-results-attendencies" class="results-table-status-col">
< /tr>
< /table>
< /body>
< /html>

(I had to add spaces just to make it good-looking in github. the actual version of html is OK)

P.S. In case if this is not sufficient, I can send you the whole project to see. Just let me know at [email protected]

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

@dbushenko I got some quick question. First how is this being compiled? Is enfocus compiled into the same js file as this snippet? If not I think you may have some form of caching issue. It seems to be complaining that enfocus.core.i_at doesn't exist. This is one of core pieces of enfocus and is required for almost anything to work. It does exist in the 1.0.0-SNAPSHOT code. I also noticed you have ":" before the id in the following selector - [":#search-results-header"]. This looks like a left over from an enlive template. It might work, but that would be by accident - possibly a feature and bug ;) .

CK

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

@ckirkendall I have checked the code and have the following.

  1. I replaced all the ":#id" to "#id" -- no result. The code still throws the same error.
  2. I compile the code with lein-cljsbuild 0.2.5 command. This is my config:

:source-path "src-clj"
:hooks [leiningen.cljsbuild]
:cljsbuild {
:repl-listen-port 9000
:repl-launch-commands
{"firefox" ["firefox"]
"firefox-naked" ["firefox" "resources/public/html/naked.html"]
"phantom" ["phantomjs" "phantom/page-repl.js"]
"phantom-naked" ["phantomjs"
"phantom/page-repl.js"
"resources/public/html/naked.html"
:stdout ".repl-phantom-naked-out"
:stderr ".repl-phantom-naked-err"]}
:test-commands
{"unit" ["phantomjs" "phantom/unit-test.js" "resources/private/html/unit-test.html"]}
:builds {
:main {
:source-path "src-cljs"
:jar true
:incremental true
:compiler {
:output-to "resources/public/js/main.js"
:warnings true
:optimizations :whitespace
:print-input-delimiter false
:output-dir ".clojurescript-output"
:externs ["jquery-externs.js"]
:libs ["closure/library/third_party/closure"]
}}}}

As you can see, I have my code compiled into main.js, and this is the single result of the compilation. So, enfocus is in the same file (main.js) as the rest of the code.

I have checked the main.js and have found enfocus there:

goog.provide("enfocus.core");
... lots of enfocus functions here ...
enfocus.core.style_set = function style_set(obj, values) { . . . }

But have not found any enfocus.core.at = function ...
or enfocus.core.i_at = function ...

Please, see the result of compilation here: https://gist.github.com/raw/3301983/0f16e9cf67309ff8f9dc23db7a71881adf043571/gistfile1.js

(gist https://gist.github.com/3301983)

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

By the way, I have found a strange issue. When I use 0.9.1 and switch the optimizations to advanced, I see totally the same broken behaviour as when I switch to enfocus 1.0.0-SNAPSHOT...

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

@dbushenko, I think I have an idea what the issue is. The js file you put in the gist has the 0.9.1 version of enfocus in it but macro code seems to be from the new. Given how clojure works I am guessing that both versions are getting on the classpath and 0.9.1 is a head of 1.0.0-SNAPSHOT. Can you do a "lein clean" and "lien deps" and see if the problems persist.

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

One moment....

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

OK, the bug which I have reported earlier was definitly in caching, so thanks for the advice. But I have found one more. I'll make a bugreport in a few minutes.

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

OK, next one is rather weird. I have the snippet:

(em/defsnippet attendee-row "/html/snippets.html" ["#search-results-row"]
[id name attendencies]
["#search-results-row-name" ] (em/content name))
["#search-results-row" ] (em/do-> (em/set-attr :onclick (str "common.select_attendee(" id ")"))
(em/set-attr :ondblclick (str "common.attendee_details(" id ")"))
(em/set-attr :id (str "search-results-row-" id)))
["#search-results-attendencies" ] (em/content (str attendencies)))

This snippet worked ok on 0.9.1. Switching to 1.0.0-SNAPSHOT breaks this snippet. It works simply just once. I mean it. I call it like this:

(defn add-attendee-row [person]
(em/at js/document
["#search-results"] (em/append
(attendee-row
(.-id person)
(.-name person)
(.-attendancies_left person)))))

(defn fill-rows [obj-list]
(dorun (map add-attendee-row obj-list)))

And I've got a table of totally identical rows, thought the obj-list in fill-rows contains different objects. I have invoked the snippet from the console like this:

common.attendee_row(17,"My name", 12);

I assumed that it will return me a table row with name "My name" and so on. But it returned the following:

< tr class="search-results-row" id="search-results-row-26" style="cursor:pointer;cursor:hand;" onclick="common.select_attendee(26)" ondblclick="common.attendee_details(26)">
< td id="search-results-row-name" class="results-table-name-col">adfaw
< td id="search-results-attendencies" class="results-table-status-col">0
</ tr>

Looks like the previous result of the snippet was memoized or something.

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

can you post your js file to a gist again.

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

one moment...

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

Please, have a look here: https://raw.github.com/gist/3304677/8053e8ae17806151dd63ae95678767720a94290d/gistfile1.txt

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

After quite a bit of pondering I think I have figured out the issue. This is a bug, there is a short term way around it though. I believe the issue is caused by snippets.html being cached twice with two different id masks. In this case the first is actually loading after the second one and overwriting the the cache. So when you call the second one it can match any of the ids because they are masked with the wrong id mask. If you add "?t=1" and "?t=2" to the first and second of snippets.html like so "snippets.html?t=1", it should fix your issue while I work on a fix.

from enfocus.

dbushenko avatar dbushenko commented on July 28, 2024

Oh, this is great!
I'll re-test everything again after you fix this issue.
Thanks!

from enfocus.

patbrown avatar patbrown commented on July 28, 2024

My dependencies were as follows

:dependencies [[org.clojure/clojure "1.4.0"]
[compojure "1.0.4"]
[hiccup "1.0.0"]
[enfocus "1.0.0-SNAPSHOT"]
]
:dev-dependencies [[lein-ring "0.7.0"]]
:plugins [[lein-cljsbuild "0.2.5"]]

Switching to the snapshot allows me to compile successfully, but my console goes pretty bonkers. It doesn't bother me though, just glad to be back to working.

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

@patbrown the crazyness on the console is caused by domina's use of protocols. The domina code is technically correct but defining protocols seems to cause warning. This looks like a bug in the compiler. I am hoping to get time this weekend to dive into it a bit more and see if I can't workout how to fix this issues.

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

I am going to close this and open an issue for both the domina compiler warnings and the snippet issue where we have snippets being loaded form the same URL path.

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.