With the ongoing refactoring of our JavaScripts as a result of jQuery 1.7 landing in Drupal 8, we are finding more resulting issues.

Here's another one: We shouldn't use isNaN() on jQuery objects anymore. The only script of ours that this effects is overlay's overlay-parent.js. We should modify the code to use isNumeric() instead.

see http://blog.jquery.com/2011/11/03/jquery-1-7-released/

CommentFileSizeAuthor
#1 1342336-is-numeric.patch986 bytesaspilicious
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aspilicious’s picture

Status: Active » Needs review
FileSize
986 bytes

A patch

cosmicdreams’s picture

 // Prevent displaced elements overlapping window's scrollbar.
     var currentMaxWidth = parseInt($(this).css(maxWidthName));
-    if ((data.drupalOverlay && data.drupalOverlay.maxWidth) || isNaN(currentMaxWidth) || currentMaxWidth > maxWidth || currentMaxWidth <= 0) {
+    if ((data.drupalOverlay && data.drupalOverlay.maxWidth) || !(isNumeric(currentMaxWidth)) || currentMaxWidth > maxWidth || currentMaxWidth <= 0) {

While this works is it proper syntax to encapsulate the isNumeric in parentheses? Appending a "!" to the front of the isNumeric should be sufficient.

cosmicdreams’s picture

Status: Needs review » Closed (works as designed)

Sorry aspilicious. It appears I sent you on a wild goose chase here.

The isNaN that is used by overlay-parent is the JavaScript core language's function not jQuery's. So this will continue to work with jQuery 1.7.

Also, the patch you provided actually causes errors since the javascript language doesn't have a isNumeric function.

We should mark this as won't fix or close it or something.

cosmicdreams’s picture

Issue summary: View changes

Edited description for accuracy. Linked reference of jQuery changes.