This is not a bug. String.prototype.startsWith is not yet a widely
available method and Google Closure Library provides
goog.string.startsWith. Use the later.

David

On Mon, Aug 31, 2015 at 1:56 PM, Felipe Gerard <[email protected]>
wrote:

> This is a minimal project to show the issue, the code breaks when using
> :advanced optimization, .startsWith  breaks:
>
> cljs code:
> **************************************************
>
> (ns minimal.core)
>
> (let [elem (.getElementById js/document "app")]
>      (set! (.-innerHTML elem) (str "Hello Worls " (.startsWith "Hello"
> "H"))))
>
> **************************************************
>
> project.clj:
> **************************************************
>
> (defproject minimal "0.1.0-SNAPSHOT"
>   :description "FIXME: write description"
>   :url "http://example.com/FIXME";
>   :license {:name "Eclipse Public License"
>             :url "http://www.eclipse.org/legal/epl-v10.html"}
>   :dependencies [[org.clojure/clojure "1.7.0"]
>                  [org.clojure/clojurescript "1.7.48"]]
>
>   :plugins [[lein-cljsbuild "1.0.6"]]
>
>   :source-paths ["src"]
>
>   :cljsbuild {:builds [{:id "dev"
>                         :source-paths ["src"]
>                         :compiler {:output-to
> "resources/public/js/components.js"
>                                    :output-dir "resources/public/js/out"
>                                    :main minimal.core
>                                    :asset-path "js/out"
>                                    :optimizations :none
>                                    :cache-analysis true
>                                    :source-map true
>                                    }}
>                        {:id "prod"
>                         :source-paths ["src"]
>                         :compiler {:output-to
> "resources/public/js/components.min.js"
>                                    :main minimal.core
>                                    :optimizations :advanced
>                                    :pretty-print false}}]}
> **************************************************
>
> index.html (this works with code not optimized)
> <!DOCTYPE html>
> <html lang="en">
> <head>
>     <meta charset="utf-8">
>     <meta http-equiv="X-UA-Compatible" content="IE=edge">
>     <meta name="viewport" content="width=device-width, initial-scale=1">
>     <title>>Test Minimal</title>
> </head>
>
> <body>
> <main role="main">
>     <section id="app"> </section>
> </main>
>
> <script src="js/components.js" type="text/javascript"></script>
>
> </body>
> </html>
>
> index-prod.html this does not work wit optimized js
> <!DOCTYPE html>
> <html lang="en">
>   <head>
>     <meta charset="utf-8">
>     <meta http-equiv="X-UA-Compatible" content="IE=edge">
>     <meta name="viewport" content="width=device-width, initial-scale=1">
>     <title>>Test Minomal</title>
>   </head>
>
>   <body>
>     <main role="main">
>       <section id="app"> </section>
>     </main>
>
>     <script src="js/components.min.js" type="text/javascript"></script>
>
>   </body>
> </html>
>
> Any ideas? or this is a true bug.
>
> --
> 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.
>

-- 
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.

Reply via email to