Starting the test server and visiting `/test/benchmark.html` runs some DOM operations (individual files in `test/performance/`) and compares their speed between the current working copy of Zepto, Zepto v1.0, jQuery 2 and a pure JS implementation of the same operation. It reports to the server the speed difference of Zepto vs jQuery; e.g. "24%" means Zepto is that much faster doing this operation than jQuery. Negative percentage means it's slower. Example server log after a run on the iPhone 4: [iOS 7.0.4] single classname: 24% (+/- 7.67%) [iOS 7.0.4] single ID: -26% (+/- 11.5%) [iOS 7.0.4] create element: -47% (+/- 10.71%)
jQuery compatibility Fixes #801
I couldn't add a test for failed auth for two reasons: * With no/wrong credentials, Chrome displays a blocking password dialog to the user. * Browsers cache credentials from one request and use it in another to the same host, leading to non-isolated tests. Fixes #627
These events don't bubble natively in any browser, so we used event capturing to provide event delegation support for them. This workaround doesn't work in IE, however. This translates focus/blur events to focusin/focusout, which bubble natively. A potential pitfall of this change is if a user inspects `event.type` inside an event handler for "focus", for instance, they will get "focusin" back. References #869, fixes #868
Android 2.3.7 browser doesn't support either `defaultPrevented` property nor `getPreventDefault()` method, but it does set `returnValue` to false once `preventDefault()` gets called. References #871
The test runner is set up to display warnings about leaked global variables. Since we expect to have artefacts of JSONP requests in form of keys named "jsonpXY" on the window object, this explicitly cleans them up so they are ignored.
Android 2.3 doesn't call the `onerror` handlers for HTTP 500 responses like it does for 404s. However, it does trigger the `onload` handler. This rewrites the JSONP implementation to use a combination of `onload` and `onerror` handlers to invoke the standard Ajax callbacks. If the JSON data was never received, this always treats it as an error even if it executed through `onload`. References #871
…at do not support __proto__
We need this in browsers which do not support it natively, namely Android 2.3. However, there's no need for the full-blown polyfill. The downside of not being a full-blown polyfill is that `stopImmediatePropagation()` won't affect handlers that are not added via Zepto's event methods; e.g. those added directly with native `addEventListener`. References #871 Reverts a1a9dce
This makes `zepto.html` pass completely on Android 2.3, and fixes these failures: EventTest#testTriggerHandler: Result of expression 'e.isImmediatePropagationStopped' [undefined] is not a function. EventTest#testEventsOnPlainObjects: Result of expression 'e.isImmediatePropagationStopped' [undefined] is not a function.
On Android 2.3.7, the fact whether default was prevented doesn't seem to be accessible on the event. Even though Android 2.3 doesn't support the `defaultPrevented` property, it was supposed to support the legacy `getPreventDefault()` method, but it doesn't. So this failure remains.
…d, fixes #870. Note that this fix exposes an issue where `removeAttr` doesn't correctly remove the `selected` attribute from `option` elements on IE. This will be handled in a seperate fix.
Previously, these methods were only available in event delegation handlers: - isDefaultPrevented - isPropagationStopped - isImmediatePropagationStopped For compatibility with jQuery and for avoiding cross-browser differences, now every event is extended with these methods before it's passed to an event handler. Alt. for #864
For GET requests, the value of `data` gets appended to the URL as query params. However, the serialized params string was also erraneously passed as request body to `xhr.send()`. This resets the `data` option to null after appending it to the URL. As a consequence, the value of `data` is no longer available in `beforeSend` callback for GET requests since the URL is already constructed and it will be too late to change it. To change query params in this callback, you must edit the `url` directly.