yui

Yui compressor StringIndexOutOfBoundsException on jboss

淺唱寂寞╮ 提交于 2019-11-27 13:11:44
问题 When minimising yui with 2.4.6, I get this problem: java.lang.StringIndexOutOfBoundsException: String index out of range: 232 at java.lang.String.substring(String.java:1934) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceString(JavaScriptCompressor.java:267) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:330) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533) It works when started

What advantages does jQuery have over other JavaScript libraries?

狂风中的少年 提交于 2019-11-27 12:57:34
问题 I am trying to convince those who set standards at my current organization that we should use jQuery rather than Prototype and/or YUI. What are some convincing advantages I can use to convince them? 回答1: The 3 main advantages of jQuery are: its light weight when compared to other javascript frameworks it has a wide range of plugins available for various specific needs it is easier for a designer to learn jQuery as it uses familiar CSS syntax. jQuery is Javascript for Designers 回答2: I would

How to automate JavaScript files compression with YUI Compressor?

风格不统一 提交于 2019-11-27 11:58:11
问题 YUI Compressor does not accept wildcard parameters, so I cannot run it like this: C:>java -jar yuicompressor.jar *.js But I have over 500 files and would rather not have to create a batch file like this: C:>java -jar yuicompressor.jar file1.js -o deploy\file1.js C:>java -jar yuicompressor.jar file2.js -o deploy\file2.js ... C:>java -jar yuicompressor.jar file500.js -o deploy\file500.js And of course my file names are not in such uniform way. Is there way to automate this without writing any

jQuery equivalent of YUI StyleSheet Utility?

狂风中的少年 提交于 2019-11-27 08:39:24
Does jQuery - or one of it's plugins - have equivalent functionality to the YUI StyleSheet Utility? "The StyleSheet Utility is capable of creating new stylesheets from scratch as well as modifying the existing stylesheets held as properties of elements sourced from the same domain or any inline elements." This (I'm fairly sure) is creating and modifying CSS stylesheets themselves not looping through the DOM and changing element's style property (as the jQuery.css() method does). I think this technique has the potential to significantly change the way a lot user interface related Javascript is

Execute function before refresh

╄→гoц情女王★ 提交于 2019-11-27 08:15:40
On my HTML page, when the user clicks / presses F5 button the page refreshes, but before it refreshes I want to execute a function or a simple alert. User can click on refresh button, press F5 or Ctrl + R . Using core JavaScript, jQuery or YUI. window.onbeforeunload = function(event) { return confirm("Confirm refresh"); }; $(window).bind('beforeunload', function(){ return '>>>>>Before You Go<<<<<<<< \n Your custom message go here'; }); Source: http://www.mkyong.com/jquery/how-to-stop-a-page-from-exit-or-unload-with-jquery/ Demo: http://www.mkyong.com/wp-content/uploads/jQuery/jQuery-stop-page

HTTPS and external (CDN) hosted files?

你离开我真会死。 提交于 2019-11-27 07:35:17
I have a page that references a couple of externally hosted javascript files - namely, jQuery on Google and YUI using YUI Loader . The trouble is when I access the page via HTTPS the browser complains of mixed insecure content, since the external javascript files are being accessed using http instead of https. What's a good way to deal with this, accessing the external jQuery and YUI Loader objects with HTTPS? Assuming the CDN provider has an https version, you can use protocol-relative URLs. For example, instead of: http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js ...you can use:

How to get child element by class name?

核能气质少年 提交于 2019-11-27 07:01:58
I'm trying to get the child span that has a class = 4. Here is an example element: <div id="test"> <span class="one"></span> <span class="two"></span> <span class="three"></span> <span class="four"></span> </div> The tools I have available are JS and YUI2. I can do something like this: doc = document.getElementById('test'); notes = doc.getElementsByClassName('four'); //or doc = YAHOO.util.Dom.get('#test'); notes = doc.getElementsByClassName('four'); These do not work in IE. I get an error that the object (doc) doesn't support this method or property (getElementsByClassName). I've tried a few

What are the typical reasons Javascript developed on Firefox fails on IE? [closed]

孤街醉人 提交于 2019-11-27 02:21:25
I developed some javascript enhanced pages that run fine on recent Firefox and Safari. I missed to check in Internet Explorer, and now I find the pages don't work on IE 6 and 7 (so far). The scripts are somehow not executed, the pages show as if javascript wasn't there, although some javascript is executed. I am using own libraries with dom manipulation, from YUI 2 I use YUI-Loader and the XML-Http-Request, and on one page I use "psupload", which depends on JQuery. I am installing Microsoft Script Editor from Office XP and will now debug. I will also write specific tests now. What are the

Need to find height of hidden div on page (set to display:none)

偶尔善良 提交于 2019-11-27 01:49:31
I need to measure the offsetHeight of a div that is inside of a hidden element. <div id="parent" style="display: none;"> <div id="child">Lorem Ipsum dolor sit amet.</div> </div> The parent div must be set to " display:none ". I have no control over that. I realize that the offsetHeight of the child div is going to be 0. I need to find a workaround. Something I've toyed with is when the page loads, I copy the childnodes of parent, inject in a div on the page that is set to " visiblity:hidden ". Then I measure the height of those elements, and remove the nodes when done. Any other thoughts?

What http status code is supposed to be used to tell the client the session has timed out?

泄露秘密 提交于 2019-11-26 19:17:59
问题 In a webpage, it uses YUI connection manager/datasource to send AJAX requests to the server, if the session (which contains the info on whether the user has been authenticated) has already timed out, those ajax responses that can only be viewed by authenticated users should return an http status code, telling the client that the session has already timed out, then the client either simply redirects him to the login page or asks him if he wants to extend the session. My question is that, in