jquery resize error

351 views
Skip to first unread message

Ross Laird

unread,
Feb 17, 2014, 7:59:19 PM2/17/14
to mezzani...@googlegroups.com
I'm getting a javascript error ("Uncaught TypeError: cannot set property of 'w' undefined") with jquery.ba-resize.js, which is included in the default Mezzanine setup. There is an open issue about this at the jquery-resize repo, but it seems that the repo has not been updated in four years. Anybody else have this issue, or any thoughts about updating this add-on for Mezzanine?

Stephen McDonald

unread,
Feb 17, 2014, 8:36:34 PM2/17/14
to mezzani...@googlegroups.com
Any hints on how to reproduce?


On Tue, Feb 18, 2014 at 11:59 AM, Ross Laird <ro...@rosslaird.com> wrote:
I'm getting a javascript error ("Uncaught TypeError: cannot set property of 'w' undefined") with jquery.ba-resize.js, which is included in the default Mezzanine setup. There is an open issue about this at the jquery-resize repo, but it seems that the repo has not been updated in four years. Anybody else have this issue, or any thoughts about updating this add-on for Mezzanine?

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Stephen McDonald
http://jupo.org

Josh Cartmell

unread,
Feb 17, 2014, 8:54:30 PM2/17/14
to mezzani...@googlegroups.com
Hey Ross, I've seen this before.

Tell me if I'm wrong but do you only see it when you log in as an admin?  In my experience, it had something to do with a jquery script trying to use the normal jquery resize functionality (https://api.jquery.com/resize/) and not working because ba-resize changes the way .resize works.

Steve, I can't find/think of a concrete example off the top of my head, but if I do I'll definitely post it up.

Ross Laird

unread,
Feb 18, 2014, 12:11:39 AM2/18/14
to mezzani...@googlegroups.com
That's interesting -- yes, I see this error only when I am logged in as admin.
I have installed some extra javascript (such as headroom.js and the prettify jQuery plugin), so one of those could be interacting with ba-resize. But it's tough for me to know how to debug this further. It's not a huge issue, as no regular user to the site will experience this error.

Stephen McDonald

unread,
Feb 18, 2014, 12:15:52 AM2/18/14
to mezzani...@googlegroups.com
I can tell you one thing at least, it only occurring when logged in as an admin user is no mystery - the file only gets used for the live editing:


I can't speak for the rest of it, its introduction was 2 years ago:


Seems to be related to managing the position of the live editing overlay - would welcome throwing out the lib in question if there's a better approach.

Josh Cartmell

unread,
Feb 18, 2014, 12:37:57 PM2/18/14
to mezzani...@googlegroups.com
I never worried about it too much since it only affected admins.  In the past I've played around with popping up the editable form in a bootstrap modal, but that requires the site to use Bootstrap, which probably isn't a good assumption.

I was just thinking (and tried it out which seemed to work) that we could change ba-resize to define a baresize event, instead of overriding jquery's default resize event.  Getting this working required two changes.  First change the beginning of https://github.com/stephenmcd/mezzanine/blob/faa736a0b42a6d6a92db13b46b9d322e2d5ffedc/mezzanine/core/static/mezzanine/js/jquery.ba-resize.min.js from
e=$.resize=$.extend($.resize,{})
to
e=$.baresize=$.extend($.baresize,{})
Then change https://github.com/stephenmcd/mezzanine/blob/faa736a0b42a6d6a92db13b46b9d322e2d5ffedc/mezzanine/core/static/mezzanine/js/editable.js#L68 to:
$('.editable-original').on('baresize', function(e) {
I did this and although I didn't test things super thoroughly the inline editing popups still pop up.

There may be a better approach, but what do you guys think?

Ross Laird

unread,
Feb 18, 2014, 10:32:44 PM2/18/14
to mezzani...@googlegroups.com
Thanks for your work on this, Josh. Much appreciated.

Josh Cartmell

unread,
Feb 19, 2014, 12:36:27 PM2/19/14
to mezzani...@googlegroups.com
No problem Ross, did you give it a try and if so did it work for you as well?

Ross Laird

unread,
Mar 3, 2014, 7:16:14 PM3/3/14
to mezzani...@googlegroups.com
I have finally got round to testing this out, and the fix does not actually work for me. The popups still do their thing, but the error persists.


--
You received this message because you are subscribed to a topic in the Google Groups "Mezzanine Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mezzanine-users/rV9Hca2FRJc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mezzanine-use...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Stephen McDonald

unread,
Mar 3, 2014, 7:19:05 PM3/3/14
to mezzani...@googlegroups.com
I don't recall the intention around this library's introduction - I'd be more than happy to remove it if someone can work out why it's there and that it's safe to remove.

Josh Cartmell

unread,
Mar 3, 2014, 9:40:39 PM3/3/14
to mezzani...@googlegroups.com
Off the top of my head I think it has something to do with resizing/centering editable popups when the window is resized.

Stephen McDonald

unread,
Mar 4, 2014, 1:21:45 AM3/4/14
to mezzani...@googlegroups.com
Yep I found where it was originally introduced, and that was the intention.

But it doesn't even work for me - I'm going to nuke it, so consider it fixed next release.

Josh Cartmell

unread,
Mar 4, 2014, 12:01:49 PM3/4/14
to mezzani...@googlegroups.com
Good stuff, thanks
Reply all
Reply to author
Forward
0 new messages