akatov / angular-contenteditable

angular model for the "contenteditable" attribute
http://akatov.github.io/angular-contenteditable/
MIT License
176 stars 55 forks source link

minify fails #7

Closed kathygit closed 11 years ago

kathygit commented 11 years ago

When I use this component in dev-mode it is fine. But when it is minified, it cause the app to fail.

akatov commented 11 years ago

can you please post the exact error message and also which minifier you used?

kathygit commented 11 years ago

Thanks you for there reply.

The only error I see in the console is "can't find configApp".

Here is the snippet of the minified js: angular.module("contenteditable",[]).directive("contenteditable",["$timeout",function(a){ return{ restrict:"A", require:"?ngModel", link:function(b,c,d,e) { if(e){ c.bind("input",function(){ b.$apply(function(){ var b,f,g; <---- there is a b in the outer scope… maybe that is the issue. b=c.html(),g=!1,d.stripBr&&"false"!==d.stripBr&&(b=b.replace(/
$/,"")),d.noLineBreaks&&"false"!==d.noLineBreaks&&(f=b.replace(/

/g,"").replace(/
/g,"").replace(/<\/div>/g,""),f!==b&&(g=!0,b=f)),e.$setViewValue(b),g&&e.$render(),""===b&&a(function(){c.blur(),c.focus() })})});var f=e.$render;e.$render=function(){var a,b,d,g;f&&f(),c.html(e.$viewValue||""),a=c.get(0),d=document.createRange(),g=window.getSelection(),a.childNodes.length>0?(b=a.childNodes[a.childNodes.length-1],d.setStartAfter(b)):d.setStartAfter(a),d.collapse(!0),g.removeAllRanges(),g.addRange(d)},d.selectNonEditable&&"false"!==d.selectNonEditable&&c.click(function(a){var b,c,d;d=a.toElement,d!==this&&"false"===angular.element(d).attr("contenteditable")&&(b=document.createRange(),c=window.getSelection(),b.setStartBefore(d),b.setEndAfter(d),c.removeAllRanges(),c.addRange(b))})}}}}])

From: Dmitri Akatov notifications@github.com<mailto:notifications@github.com> Reply-To: akatov/angular-contenteditable reply@reply.github.com<mailto:reply@reply.github.com> Date: Tuesday, October 15, 2013 1:27 PM To: akatov/angular-contenteditable angular-contenteditable@noreply.github.com<mailto:angular-contenteditable@noreply.github.com> Cc: Corporate User kathy.laird@emc.com<mailto:kathy.laird@emc.com> Subject: Re: [angular-contenteditable] minify fails (#7)

can you please post the exact error message and also which minifier you used?

— Reply to this email directly or view it on GitHubhttps://github.com/akatov/angular-contenteditable/issues/7#issuecomment-26364614.

kathygit commented 11 years ago

If I move contenteditable.js before http-auth-interceptors.js, it works. It is odd that the order matters here.

juhana commented 10 years ago

The problem is caused by a missing semicolon at the end of angular-contenteditable.js.

After source files are concatenated and if the next file starts with a parenthesis the JS engine thinks that it's all part of a single anonymous function call. Adding a semicolon at the end of the file would fix this problem.