Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

jqmDataRE kills SAP URLs with brackets #4849

Closed
cawoodm opened this Issue · 4 comments

2 participants

@cawoodm

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;

@johnbender

@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.

@johnbender johnbender was assigned
@johnbender johnbender closed this issue from a commit
@johnbender johnbender 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
@johnbender johnbender reopened this
@johnbender johnbender closed this issue from a commit
@johnbender johnbender 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
@johnbender

Pushed to master.

@cawoodm

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

@cawoodm

Yes, thanks for the amazingly fast fix!

@johnbender

@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.

@arschmitz arschmitz referenced this issue from a commit in arschmitz/jquery-mobile
@johnbender johnbender 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.