Add examples, remove failing test #44

Merged
rstacruz merged 3 commits from fix/stuff into master 2015-11-14 06:28:26 -05:00
rstacruz commented 2015-11-12 18:45:11 -05:00 (Migrated from github.com)

This adds examples to /example. This shows that the plugin right now is at a state that doesn't actually work:

pasted_image_11_13_15__10_44_am

I've removed the failing test now so the test suite should pass, but that's no indicator that the project is in a working state.

This adds examples to `/example`. This shows that the plugin right now is at a state that doesn't actually work: ![pasted_image_11_13_15__10_44_am](https://cloud.githubusercontent.com/assets/74385/11134778/95263c08-89f3-11e5-9aa3-d76573604c94.png) I've removed the failing test now so the test suite should pass, but that's no indicator that the project is in a working state.
rstacruz commented 2015-11-12 18:53:26 -05:00 (Migrated from github.com)

also some breakages I've found: this IE workaround actually breaks things because el in this case is the document root element (<html>), which can't be inserted into the document.body of course.

     forEachEls(els, function(el) {
       var domFix = false
-      if (!el.parentNode) {
         // THANKS YOU IE (9/10//11 concerned)
         // dispatchEvent doesn't work if element is not in the dom
-        domFix = true
-        document.body.appendChild(el)
-      }
       el.dispatchEvent(event)
-      if (domFix) {
-        el.parentNode.removeChild(el)
-      }
     })
also some breakages I've found: this IE workaround actually breaks things because `el` in this case is the document root element (`<html>`), which can't be inserted into the `document.body` of course. ``` diff forEachEls(els, function(el) { var domFix = false - if (!el.parentNode) { // THANKS YOU IE (9/10//11 concerned) // dispatchEvent doesn't work if element is not in the dom - domFix = true - document.body.appendChild(el) - } el.dispatchEvent(event) - if (domFix) { - el.parentNode.removeChild(el) - } }) ```
rstacruz commented 2015-11-12 18:55:19 -05:00 (Migrated from github.com)

Another: onSwitch is not available here because this isn't what you think it is—it's probably simply missing a .bind somewhere.

module.exports = {
  outerHTML: function(oldEl, newEl) {
    oldEl.outerHTML = newEl.outerHTML
-   this.onSwitch()
  },

  innerHTML: function(oldEl, newEl) {
    oldEl.innerHTML = newEl.innerHTML
    oldEl.className = newEl.className
-   this.onSwitch()
  },
Another: `onSwitch` is not available here because `this` isn't what you think it is—it's probably simply missing a `.bind` somewhere. ``` diff module.exports = { outerHTML: function(oldEl, newEl) { oldEl.outerHTML = newEl.outerHTML - this.onSwitch() }, innerHTML: function(oldEl, newEl) { oldEl.innerHTML = newEl.innerHTML oldEl.className = newEl.className - this.onSwitch() }, ```
MoOx commented 2015-11-13 02:12:14 -05:00 (Migrated from github.com)

I guess the hirerarchy error come from the IE workaround :/
For the onSwitch, it's probably because I didn't finish what I started.

I guess the hirerarchy error come from the IE workaround :/ For the onSwitch, it's probably because I didn't finish what I started.
MoOx commented 2015-11-13 02:12:57 -05:00 (Migrated from github.com)

That why I added a failing test, to remember where to continue :)

That why I added a failing test, to remember where to continue :)
rstacruz commented 2015-11-13 08:00:19 -05:00 (Migrated from github.com)

okay—removed the removal of that test, so it should fail now. this PR should at least give you a nice example to replicate #39.

okay—removed the removal of that test, so it should fail now. this PR should at least give you a nice example to replicate #39.
MoOx commented 2015-11-14 06:28:24 -05:00 (Migrated from github.com)

Thanks for this.

Thanks for this.
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#44