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: SortableJS/Sortable
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: dev101/Sortable
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.
  • 6 commits
  • 1 file changed
  • 1 contributor

Commits on Jan 20, 2016

  1. Calling this[fn].bind required extra check

    It is not valid to assume that Sortable's **prototype contains what you expect it to**.
    
    In my environment, Sortable is loaded by `requirejs`, and the **prototype is modified** in requirejs's loader callback by injecting a special `__moduleId__` property into the prototype, in a fashion like this:
    ```javascript
            requirejs.onResourceLoad = function(context, map, depArray) {
                context.defined[map.id].prototype.__moduleId__ = map.id;
            };
    ```
    At [Sortable.js#L232](https://github.com/RubaXa/Sortable/blob/master/Sortable.js#L232) this effectively leads to trying to call `.bind` on a `String` object, resulting in `this[fn].bind is not a function` error.
    
    There should be a smarter way to copy functions from the prototype, so far I can suggest an extra check for object type before calling `.bind`:
    ```javascript
    if (fn.charAt(0) === '_' && typeof(this[fn].bind) === 'function') {
    	this[fn] = this[fn].bind(this);
    }
    ```
    dev101 committed Jan 20, 2016
    Configuration menu
    Copy the full SHA
    5b41964 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #1 from dev101/dev101-patch-1

    Calling this[fn].bind required extra check
    dev101 committed Jan 20, 2016
    Configuration menu
    Copy the full SHA
    6de0e14 View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2016

  1. Module definition improved

    dev101 committed Jan 22, 2016
    Configuration menu
    Copy the full SHA
    c289065 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #4 from dev101/dev101-patch-3

    Module definition improved in knockout-sortable.js
    dev101 committed Jan 22, 2016
    Configuration menu
    Copy the full SHA
    20ec750 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ac85bf3 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #5 from dev101/revert-4-dev101-patch-3

    Revert "Module definition improved in knockout-sortable.js"
    dev101 committed Jan 22, 2016
    Configuration menu
    Copy the full SHA
    d86ca80 View commit details
    Browse the repository at this point in the history
Loading