adding greedy space to model url splitter #284

merged 1 commit into from Feb 21, 2013

2 participants


I am migrating a JMVC app over to CanJS and encountered strange DOM Exception 12 errors on model CRUD events. It took me a while to chase them down and discovered that the splitter employed in CanJS was failing to properly spit on my URLs because I used multiple spaces. I like all my routes to line up "just so" for better readability:

        findAll:  "GET    /api/" + AWT.api_version + "/advertisements.json",
        findOne : "GET    /api/" + AWT.api_version + "/advertisements/{id}.json",
        create :  "POST   /api/" + AWT.api_version + "/advertisements/advertisement.json",
        update :  "PUT    /api/" + AWT.api_version + "/advertisements/{id}.json",
        destroy : "DELETE /api/" + AWT.api_version + "/advertisements/{id}.json",

JMVC handled these routes okay.

This little fix just makes the splitter greedier to handle the extra spaces.

@onyxrev onyxrev adding greedy space to model url splitter
to avoid obscure DOM Exception 12 errors for people who include extra spaces in their URLs (better matches old JMVC behavior)

Looks good, thanks! Will merge it into 1.1.5.

@daffl daffl merged commit 5c3ce67 into canjs:master Feb 21, 2013

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment