javascript validation of on() method

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
willie
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 4
Joined: Tue Dec 04, 2007 1:05 am

javascript validation of on() method

Post by willie » Sun Mar 23, 2014 1:41 am

CSE fails to validate a Javascript file I am using, displaying the message that the on() method is not valid, yet the W3 folks and others now explain that this method is used in jQuery to replace the bind, delegate, and live event handlers...is there an update to the CSE Javascript validator, or, how else shall we deal with this issue?

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3412
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: javascript validation of on() method

Post by Albert Wiersch » Mon Mar 24, 2014 8:10 am

Hello,

Can you provide a sample JavaScript file that reproduces the message and a copy and paste of the exact validator message you are getting?

Thanks.
Image
Albert Wiersch

willie
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 4
Joined: Tue Dec 04, 2007 1:05 am

Re: javascript validation of on() method

Post by willie » Mon Mar 24, 2014 6:24 pm

I have attached a large screenshot file (sorry about that), the Zepto core I am using, and the Zepto-Tooltip module that is the reason for the validation error, it seems.

Thank you Al for looking into this. It is not a major issue since other browsers seem to validate the code, other than for undeclared variables, but it does hinder CSE batch file validation a bit.

(I believe that I have attached three files, yet I am unable to verify this from your board site display...let me know if I have failed to do so.)

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3412
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: javascript validation of on() method

Post by Albert Wiersch » Mon Mar 24, 2014 7:35 pm

Unfortunately I do not see any attachments. You may want to try editing your post and see if you can add them. Make sure you click 'Add the file' after choosing the attachment.

I'm pretty sure there are ways around these issues with the JSLint configuration:
http://www.jslint.com/lint.html

But I would want to see the actual messages and a code sample to be sure.
Image
Albert Wiersch

willie
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 4
Joined: Tue Dec 04, 2007 1:05 am

Re: javascript validation of on() method

Post by willie » Tue Mar 25, 2014 12:07 am

Second attempt, but I just installed your newest upgrade, and have not yet tried it.

Got it. I have now noticed the error messages. Jpg is too large, and .js is not permitted.

/*!
* zepto-tooltip - v1.1.2 - 2013-08-19
* https://github.com/ptech/zepto-tooltip
*
* Copyright (c) 2013 Present Technologies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(a){"use strict";var b,c=$("[rel~=tooltip]"),d=!1,e=!1;c.on("mouseover",function(){if(d=$(this),b=d.attr("title"),e=$('<div class="tooltip"></div>'),!b||""===b)return!1;d.removeAttr("title"),e.css("opacity",0).html(b).appendTo("body");var c=function(){$(a).width()<1.5*e.width()?e.css("max-width",$(a).width()/2):e.css("max-width",340);var b=d.offset().left+d.width()/2-e.width()/2,c=d.offset().top-e.height()-20;0>b?(b=d.offset().left+d.width()/2-20,e.addClass("left")):e.removeClass("left"),b+e.width()>$(a).width()?(b=d.offset().left-e.width()+d.width()/2+20,e.addClass("right")):e.removeClass("right"),0>c?(c=d.offset().top+d.height(),e.addClass("top")):e.removeClass("top"),e.css({left:b,top:c}).animate({translateY:"10px",opacity:1},50)};c(),$(a).resize(c);var f=function(){e.animate({translateY:"-10px",opacity:0},50,"linear",function(){$(this).remove()}),d.attr("title",b)};d.on("mouseout",f),e.on("click",f)})}(window);
!function(a){"use strict";var b,c=$("[rel~=joyo]"),d=!1,e=!1;c.on("mouseover",function(){if(d=$(this),b=d.attr("title"),e=$('<div class="joyo"></div>'),!b||""===b)return!1;d.removeAttr("title"),e.css("opacity",0).html(b).appendTo("body");var c=function(){$(a).width()<1.5*e.width()?e.css("max-width",$(a).width()/2):e.css("max-width",340);var b=d.offset().left+d.width()/2-e.width()/2,c=d.offset().top-e.height()-20;0>b?(b=d.offset().left+d.width()/2-20,e.addClass("left")):e.removeClass("left"),b+e.width()>$(a).width()?(b=d.offset().left-e.width()+d.width()/2+20,e.addClass("right")):e.removeClass("right"),0>c?(c=d.offset().top+d.height(),e.addClass("top")):e.removeClass("top"),e.css({left:b,top:c}).animate({translateY:"10px",opacity:1},50)};c(),$(a).resize(c);var f=function(){e.animate({translateY:"-10px",opacity:0},50,"linear",function(){$(this).remove()}),d.attr("title",b)};d.on("mouseout",f),e.on("click",f)})}(window);
Attachments
cse_zepto_fail.jpg
cse_zepto_fail.jpg (138.71 KiB) Viewed 3829 times

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3412
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: javascript validation of on() method

Post by Albert Wiersch » Tue Mar 25, 2014 7:58 am

Oh, I see. It looks like you are getting this message from the integrated web browser. I was thinking it was a validator message from a JavaScript checker, like from JSLint.

Such dialogs could be due to how you have your paths setup. If previewing a document in the integrated web browser, then it's best if all paths are relative so it can find the needed files, or you might be able to setup path mappings so the preview can be run through a web server first (especially if you are running a web server locally). See the path mapping options in the integrated web browser toolbar's drop-down options (the gear with the down pointing arrow) and the documentation on it. Another option may be to select the 'Silent Mode' option to keep the integrated web browser from displaying dialogs like the one you attached (this may be the easiest solution).

I hope this helps. If you have any further questions, then please let me know.
Image
Albert Wiersch

Post Reply