Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: prototypejs/prototype
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: efedin/prototype
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Feb 12, 2011

  1. Using local function each()

    Using local function each() to prevent consequenses
    of Array.prototype.each() replacing. It happens when
    prototype.js is using with mootools.js for example.
    
    Basic situation when there is an error:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools.js"></script>
    <script type="text/javascript">
    var justArray = ["A", "B"];
    var elementFromArray = "A";
    var check = function(value) {
            return value === elementFromArray;
    };
    console.log(justArray.some(check));
    </script>
    
    This problem arise from
    Array.prototype.each = Array.prototype.forEach;
    in mootools.js and from using this property in Enumerable: local one handles exceptions,
    native does not do it. Thus all(), every(), any(), some(), detect(), include() properties are broken
    when they throw exception.
    
    This patch solve the problem by using local each().
    efedin committed Feb 12, 2011
    Configuration menu
    Copy the full SHA
    0ad9fd0 View commit details
    Browse the repository at this point in the history
Loading