Skip to content
This repository

jqmDataRE kills SAP URLs with brackets #4849

Closed
cawoodm opened this Issue August 15, 2012 · 4 comments

2 participants

Marc John Bender
Marc

In jquery.mobile-1.1.1.js on line 1543 there is the following:
jqmDataRE = /:jqmData(([^)]*))/g;

This basically searches a string from :jqmData till the end or next closing bracket .

However, some URLs (like those of SAP BSPs) have brackets in them. Example:
http://mysapserver.com/abc(bD1lbiZjPTEwMA==)/bsp/cat/controller.do

Such URLs get destroyed by the above RegEx.
:jqmData(url='/zlgs(bD1lbiZjPTEwMA==)/bsp/cat/controller.do?a=0000603565')
becomes
[data-url='/zlgs(bD1lbiZjPTEwMA==]/bsp/cat/controller.do?a=0000603566')

which is an invalid jQuery selector.

Basically the jqmDataRE regex assumes URLs do not have brackets in them and SAP URLs always have brackets in them.

I have found searching for a space to be better:

jqmDataRE = /:jqmData(([^ ]*))/g;

John Bender

@cawoodm

Thanks for logging the issue.

We clearly need to deal with this case given that the paren is a valid URL char per the spec. Unfortunately your proposed change won't work because we may (now or in the future) have data-namesspace-attribute selectors that contain whitespace. Eg

$( ":jqmData(text='foo bar baz')" );

It looks like we'll have to do a manual namespace concat in the places where we're selecting on the URL. I should have a patch for this some time today.

John Bender johnbender closed this issue from a commit August 15, 2012
John Bender Handle urls with parens properly
The regular expression used to parse the jqmData psuedo selector restricts the
use of parentheses which are valid in urls. This breaks data-ns-url selection.
The fix is to avoid the pseudo selector. Fixes #4849
ca94e5f
John Bender johnbender closed this in ca94e5f August 15, 2012
John Bender johnbender reopened this August 15, 2012
John Bender johnbender closed this issue from a commit August 15, 2012
John Bender Handle urls with parens properly
The regular expression used to parse the jqmData psuedo selector restricts the
use of parentheses which are valid in urls. This breaks data-ns-url selection.
The fix is to avoid the pseudo selector. Fixes #4849
cb15dc3
John Bender johnbender closed this in cb15dc3 August 15, 2012
John Bender

Pushed to master.

@cawoodm

Can you verify that this works for you by including http://jquerymobile.com/branches/1.1-stable/js/ for JQM?

Marc

Yes, thanks for the amazingly fast fix!

John Bender

@cawoodm

No problem, I'm sorry we don't have something more comprehensive for the selector. All I could do was add docs. This will go out with the 1.2 release candidate and 1.1.2.

Alexander Schmitz arschmitz referenced this issue from a commit in arschmitz/jquery-mobile August 15, 2012
John Bender Handle urls with parens properly
The regular expression used to parse the jqmData psuedo selector restricts the
use of parentheses which are valid in urls. This breaks data-ns-url selection.
The fix is to avoid the pseudo selector. Fixes #4849
a96a203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.