google-closure

Drag and drop events in embedded SVG?

这一生的挚爱 提交于 2019-12-06 20:37:07
问题 Is there any possibility of receiving drag and drop events from SVG elements within a web page? I tried the Google Closure library, to no avail. Specifically, suppose my page contains <ul id = "list"> <li class="item" id="item1">foo</li> <li class="item">bar</li> <li class="item">baz</li> </ul> And my script contains (Clojurescript/C2) (let [items (select-all ".item") lst (select "#list") target (fx/DragDrop. lst nil)] (dorun (map (fn [item] (let [source (fx/DragDrop. item nil)] (. source

Variables in Google Closure

China☆狼群 提交于 2019-12-06 06:19:04
http://closure-compiler.appspot.com/home (function(){ var somevar = 'somevar'; this.each(function(){ var minify_var = { method1: somevar + '1', method2: somevar + '2', method3: somevar + '3', method4: somevar + '4', method5: somevar + '5' }; alert(minify_var); }); })(); Code like this is minified to: (function(){this.each(function(){alert({method1:"somevar1",method2:"somevar2",method3:"somevar3",method4:"somevar4",method5:"somevar5"})})})(); Which is definitely bigger at length (+11 symbols) than: (function(){var a="somevar";this.each(function(){alert({method1:a+"1",method2:a+"2",method3:a+"3"

How to configure karma-runner (also known as testacular) to work with closure-library

房东的猫 提交于 2019-12-06 05:57:40
问题 I'm trying to use karma-runner with mocha testing framework to test an application built with closure-library and angularjs. I always get namespace.Application is not defined thanks in advance. here's my config file basePath = ''; files = [ MOCHA, MOCHA_ADAPTER, {pattern: 'vendors/closure-library/closure/goog/base.js', watched: false, included: true, served: true}, {pattern: 'public/javascripts/deps.js', watched: true, included: true, served: true}, {pattern: 'node_modules/expect.js/expect.js

How do I use Google Closure compiler to remove unused JavaScript code?

泄露秘密 提交于 2019-12-05 21:34:58
问题 How do I use Google Closure compiler to remove unused code? I am using the JQuery Slider control but am not using anything else within JQuery. So I read that Google Closure compiler in Advanced mode can remove unused code, but I don't know how . I have frontpage.html that links to an external JQuery, JQuery UI and JQuery Slider control from that html page hosted on my site. On my frontpage.html, I also have JavaScript embedded within the HTML that initiates the JQuery Slider control. How do I

problems creating custom event dispatcher in google closure library

血红的双手。 提交于 2019-12-05 16:44:31
I'm trying to create a custom event dispatcher in google closure js library. I'm basing this code off of the animation class in the fx folder, yet I keep getting this error.. "goog.events is undefined" yet I'm including the events package at the top. here is my code. goog.provide('test.util.Animation'); goog.provide('test.util.Animation.EventType'); goog.provide('test.util.AnimationEvent'); goog.require('goog.events'); goog.require('goog.events.EventTarget'); goog.require('goog.events.EventType'); /** * Constructor for an animation object. * @constructor * @extends {goog.events.EventTarget} */

Adding sub-properties to an existing property-list in jsdoc

邮差的信 提交于 2019-12-05 14:54:47
I am trying to automate a particular module in our JS library and am stuck at a point where I want to define a set of properties (lets say an object that goes as construction parameter of a class). /** * This function initiates world peace! * @constructor * @param {object} defaults - The options to initiate peace. * @param {number} defaults.issues - The number of issues being taken up. * @param {string} defaults.source - The name of the location where process starts. */ var WorldPeace = function (defaults) { // code here }; It is well and good had all properties of the construction was defined

Why does Google Closure Compiler adds variable to the global namespace when the original namespace was empty?

时光总嘲笑我的痴心妄想 提交于 2019-12-05 14:35:25
I have a long script nicely wrapped into a (function() {/.../})() to avoid all kind of name pollution. It is 100% typed with zero warning. I found out that Google Closure compiler starts by redefining i and j in the global namespace which feels both unnecessary and dangerous, especially since I am compiling a script that has zero interference with the namespace. (the compiled script starts with var i=null,j=!1; , for compactness reasons I believe). I can think of a work around which is to wrap it using the --output_wrapper but I can't think of a reason why Google would pollute the namespace

Google closure variable window/event/console/… is undeclared error

妖精的绣舞 提交于 2019-12-05 11:59:20
I'm trying to compile one of my HTML5 project using Google Closure. I'm recieving several errors that I don't know how to solve. In fact, it's the same error but for different variables. Here the errors messages: variable window is undeclared variable event is undeclared variable console is undeclared variable Audio is undeclared These variables are Javascript built-in variables. If I compile this same project directly in command-line, it works. But, in my case, I need to compile this project using an ant file (build process). My ant build script is using the same jar file that I use in

Looking for a template engine which can be used in Java and JavaScript [closed]

时光毁灭记忆、已成空白 提交于 2019-12-05 11:01:08
As the title says, I'm currently looking for a template engine that works with Java and Javascript. The idea is that my ajax json objects can use the same template files to render stuff client-side like Java is doing it server-side. I know there is google-closure-template but it is working with guice 2.0 and my current project runs under guice 3.0 and both together just create wierd errors and I tried using them but failed for about 2 weeks now... So is there anything apart from google-closure? You can take a look at Mustache . Tomas Randus Also Histone seems to be for both BTW: the same topic

Why does Google's Closure Compiler leave a few unnecessary spaces or line breaks?

送分小仙女□ 提交于 2019-12-05 09:08:26
问题 I've noticed that every time I use Google's Closure Compiler Service, it leaves a few unnecessary spaces in the compiled code presented on the right-hand side of the page. These correspond to line breaks in the hosted version of the compiled code. For example (note the line breaks, each of which seems unnecessary): http://troy.onespot.com/static/stack_overflow/closure_spaces.js To date, I've just been removing them manually, but I'm curious why they're there. Is it to limit the line length of