Details
Description
As a compatibility and convenience measure, ICEfaces extends the prototypes of native JS types with a variety of helper functions and shims for advanced ECMAscript features.
However the extend ends up overwriting functions that have existing native implementations. This is generally discouraged for a few of reasons, primarily that this has a global effect, and that the overwriting implementation may not provide the expected functionality to 3rd party scripts, or that the overwriting implementation is slower due to being evaluated JS versus native C JSVM code.
I encountered this issue when attempting to use Array.prototype.filter to filter a NodeList as recommended by MDN documentation and it broke due to our implementations assumptions. As higher-order JS techniques like this become more popular we run greater risk of being incompatible.
A naive change, if possible would be to make extend not overwrite. If extend is used with the expectation of overwriting throughout or code this may not be possible however. In that case we may need to alter the calls to extend prototypes to indicate explicitly not to overwrite.
However the extend ends up overwriting functions that have existing native implementations. This is generally discouraged for a few of reasons, primarily that this has a global effect, and that the overwriting implementation may not provide the expected functionality to 3rd party scripts, or that the overwriting implementation is slower due to being evaluated JS versus native C JSVM code.
I encountered this issue when attempting to use Array.prototype.filter to filter a NodeList as recommended by MDN documentation and it broke due to our implementations assumptions. As higher-order JS techniques like this become more popular we run greater risk of being incompatible.
A naive change, if possible would be to make extend not overwrite. If extend is used with the expectation of overwriting throughout or code this may not be possible however. In that case we may need to alter the calls to extend prototypes to indicate explicitly not to overwrite.
Issue Links
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Nils Lundquist
created issue -
Nils Lundquist
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Nils Lundquist [ nils.lundquist ] |
Arturo Zambrano
made changes -
Arturo Zambrano
made changes -
Arturo Zambrano
made changes -
Arturo Zambrano
made changes -
Nils Lundquist
made changes -
Assignee Priority | P1 [ 10010 ] |
Nils Lundquist
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Ken Fyten
made changes -
Fix Version/s | 4.0 [ 11382 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |