packages feed

miso 1.8.2.0 → 1.8.3.0

raw patch · 6 files changed

+78/−78 lines, 6 files

Files

jsbits/delegate.js view
@@ -4,7 +4,7 @@  /* Callbacks in ghcjs need to be released. With this function one can register    callbacks that should be released right before diffing.-*/+   */ window['registerCallback'] = function registerCallback(cb) {   window['currentCallbacks'].push(cb); };@@ -55,19 +55,19 @@    /* stack.length == 1 */   else {-      var eventObj = obj['events'][event.type];-      if (eventObj) {-        var options = eventObj.options;-        if (options['preventDefault'])-            event.preventDefault();-        eventObj['runEvent'](event);-        if (!options['stopPropagation'])-           window['propogateWhileAble'] (parentStack, event);-      } else {-        /* still propagate to parent handlers even if event not defined */+    var eventObj = obj['events'][event.type];+    if (eventObj) {+      var options = eventObj.options;+      if (options['preventDefault'])+        event.preventDefault();+      eventObj['runEvent'](event);+      if (!options['stopPropagation'])         window['propogateWhileAble'] (parentStack, event);-      }-   }+    } else {+      /* still propagate to parent handlers even if event not defined */+      window['propogateWhileAble'] (parentStack, event);+    }+  } };  window['buildTargetToElement'] = function buildTargetToElement (element, target) {@@ -83,7 +83,7 @@   for (var i = 0; i < parentStack.length; i++) {     if (parentStack[i]['events'][event.type]) {       var eventObj = parentStack[i]['events'][event.type],-          options = eventObj['options'];+        options = eventObj['options'];       if (options['preventDefault']) event.preventDefault();       eventObj['runEvent'](event);       if (options['stopPropagation']) break;@@ -129,12 +129,12 @@  /* get static and dynamic properties */ function getAllPropertyNames(obj) {-    var props = {}, i = 0;-    do {-        var names = Object.getOwnPropertyNames(obj);-        for (i = 0; i < names.length; i++) {-          props [names[i]] = null;-        }-    } while (obj = Object.getPrototypeOf(obj));+  var props = {}, i = 0;+  do {+    var names = Object.getOwnPropertyNames(obj);+    for (i = 0; i < names.length; i++) {+      props [names[i]] = null;+    }+  } while (obj = Object.getPrototypeOf(obj));   return props; };
jsbits/diff.js view
@@ -65,10 +65,10 @@  window['populate'] = function populate(c, n, doc) {   if (!c) c = {-              props: null,-              css: null,-              children: []-              }+    props: null,+    css: null,+    children: []+  }   window['diffProps'](c['props'], n['props'], n['domRef'], n['ns'] === 'svg');   window['diffCss'](c['css'], n['css'], n['domRef']);   window['diffChildren'](c['children'], n['children'], n['domRef'], doc);@@ -186,15 +186,15 @@ /* Child reconciliation algorithm, inspired by kivi and Bobril */ window['syncChildren'] = function syncChildren(os, ns, parent, doc) {   var oldFirstIndex = 0,-  newFirstIndex = 0,-  oldLastIndex = os.length - 1,-  newLastIndex = ns.length - 1,-  nFirst, nLast, oLast, oFirst, tmp, found, node;+    newFirstIndex = 0,+    oldLastIndex = os.length - 1,+    newLastIndex = ns.length - 1,+    nFirst, nLast, oLast, oFirst, tmp, found, node;   for (;;) {     /* check base case, first > last for both new and old       [ ] -- old children empty (fully-swapped)       [ ] -- new children empty (fully-swapped)-    */+      */     if (newFirstIndex > newLastIndex && oldFirstIndex > oldLastIndex) {       break;     }@@ -207,7 +207,7 @@     /* No more old nodes, create and insert all remaining nodes        -> [ ] <- old children        -> [ a b c ] <- new children-    */+       */     if (oldFirstIndex > oldLastIndex) {       window['diff'](null, nFirst, parent, doc);       /* insertBefore's semantics will append a node if the second argument provided is `null` or `undefined`.@@ -219,7 +219,7 @@     /* No more new nodes, delete all remaining nodes in old list        -> [ a b c ] <- old children        -> [ ] <- new children-    */+       */     else if (newFirstIndex > newLastIndex) {       tmp = oldLastIndex;       while (oldLastIndex >= oldFirstIndex) {@@ -232,7 +232,7 @@        -> oldFirstIndex -> [ a b c ] <- oldLastIndex        -> newFirstIndex -> [ a b c ] <- newLastIndex        check if nFirst and oFirst align, if so, check nLast and oLast-    */+       */     else if (oFirst['key'] === nFirst['key']) {       window['diff'](os[oldFirstIndex++], ns[newFirstIndex++], parent, doc);     } else if (oLast['key'] === nLast['key']) {@@ -242,7 +242,7 @@        both could have been swapped.        -> [ a b c ] <- old children        -> [ c b a ] <- new children-    */+       */     else if (oFirst['key'] === nLast['key'] && nFirst['key'] === oLast['key']) {       window['swapDomRefs'](node, oLast['domRef'], oFirst['domRef'], parent);       window['swap'](os, oldFirstIndex, oldLastIndex);@@ -259,7 +259,7 @@            -> [ a b d ] <- old children            -> [ a b d ] <- new children            and now we happy path-       */+           */     else if (oFirst['key'] === nLast['key']) {       /* insertAfter */       parent.insertBefore(oFirst['domRef'], oLast['domRef'].nextSibling);@@ -275,7 +275,7 @@        -> [ d b a ] <- old children        -> [ d b a ] <- new children        and now we happy path-    */+       */     else if (oLast['key'] === nFirst['key']) {       /* insertAfter */       parent.insertBefore(oLast['domRef'], oFirst['domRef']);@@ -289,7 +289,7 @@        This can happen when the list is sorted, for example.        -> [ a e c ] <- old children        -> [ b e d ] <- new children-    */+       */     else {       /* final case, perform linear search to check if new key exists in old map, decide what to do from there */       found = false;@@ -302,7 +302,7 @@         }         tmp++;       }-          /* If new key was found in old map this means it was moved, hypothetically as below+      /* If new key was found in old map this means it was moved, hypothetically as below          -> [ a e b c ] <- old children          -> [ b e a j ] <- new children           ^@@ -313,7 +313,7 @@          -> [ b a e c ] <- old children          -> [ b e a j ] <- new children             ^-      */+            */       if (found) {         /* Move item to correct position */         os.splice(oldFirstIndex,0, os.splice(tmp,1)[0]);@@ -324,7 +324,7 @@         /* increment counters */         newFirstIndex++;       }-        /* If new key was *not* found in the old map this means it must now be created, example below+      /* If new key was *not* found in the old map this means it must now be created, example below            -> [ a e d c ] <- old children            -> [ b e a j ] <- new children             ^@@ -335,7 +335,7 @@            -> [ b a e d c ] <- old children            -> [ b e a j   ] <- new children               ^-           */+              */       else {         window['createElement'](nFirst, doc);         parent.insertBefore(nFirst['domRef'], oFirst['domRef']);
jsbits/isomorphic.js view
@@ -14,28 +14,28 @@  window['copyDOMIntoVTree'] = function copyDOMIntoVTree(logLevel,mountPoint, vtree, doc) {   if (!doc) { doc = window.document; }-    var mountChildIdx = 0, node;-    // If script tags are rendered first in body, skip them.-    if (!mountPoint) {-      if (doc.body.childNodes.length > 0) {-          node = doc.body.firstChild;-      } else {-          node = doc.body.appendChild (doc.createElement('div'));-      }-    } else if (mountPoint.childNodes.length === 0) {-      node = mountPoint.appendChild (doc.createElement('div'));+  var mountChildIdx = 0, node;+  // If script tags are rendered first in body, skip them.+  if (!mountPoint) {+    if (doc.body.childNodes.length > 0) {+      node = doc.body.firstChild;     } else {-      while (mountPoint.childNodes[mountChildIdx] && (mountPoint.childNodes[mountChildIdx].nodeType === Node.TEXT_NODE || mountPoint.childNodes[mountChildIdx].localName === 'script')){-        mountChildIdx++;-      }-      if (!mountPoint.childNodes[mountChildIdx]) {-          node = doc.body.appendChild (doc.createElement('div'));-      } else {-          node = mountPoint.childNodes[mountChildIdx];-        }+      node = doc.body.appendChild (doc.createElement('div'));     }+  } else if (mountPoint.childNodes.length === 0) {+    node = mountPoint.appendChild (doc.createElement('div'));+  } else {+    while (mountPoint.childNodes[mountChildIdx] && (mountPoint.childNodes[mountChildIdx].nodeType === Node.TEXT_NODE || mountPoint.childNodes[mountChildIdx].localName === 'script')){+      mountChildIdx++;+    }+    if (!mountPoint.childNodes[mountChildIdx]) {+      node = doc.body.appendChild (doc.createElement('div'));+    } else {+      node = mountPoint.childNodes[mountChildIdx];+    }+  } -    if (!window['walk'](logLevel,vtree, node, doc)) {+  if (!window['walk'](logLevel,vtree, node, doc)) {     if (logLevel) {       console.warn('Could not copy DOM into virtual DOM, falling back to diff');     }@@ -52,7 +52,7 @@ }  window['diagnoseError'] = function diagnoseError(logLevel, vtree, node) {-    if (logLevel) console.warn('VTree differed from node', vtree, node);+  if (logLevel) console.warn('VTree differed from node', vtree, node); }  window['walk'] = function walk(logLevel, vtree, node, doc) {@@ -60,7 +60,7 @@   // browsers will collapse consecutive text nodes into a single text node.   // There can thus be fewer DOM nodes than VDOM nodes.   var vdomChild,-      domChild;+    domChild;    vtree['domRef'] = node; @@ -71,21 +71,21 @@   for (var i = 0; i < vtree.children.length; i++) {     vdomChild = vtree['children'][i];     domChild = node.childNodes[i];-      if (!domChild) {-        window['diagnoseError'](logLevel,vdomChild, domChild);-        return false;-      }+    if (!domChild) {+      window['diagnoseError'](logLevel,vdomChild, domChild);+      return false;+    }     if (vdomChild.type === 'vtext') {-        if (domChild.nodeType !== Node.TEXT_NODE) {-            window['diagnoseError'](logLevel, vdomChild, domChild);-          return false;+      if (domChild.nodeType !== Node.TEXT_NODE) {+        window['diagnoseError'](logLevel, vdomChild, domChild);+        return false;       } -        if (vdomChild['text'] === domChild.textContent) {-          vdomChild['domRef'] = domChild;-        } else {-          window['diagnoseError'](logLevel, vdomChild, domChild);-          return false;+      if (vdomChild['text'] === domChild.textContent) {+        vdomChild['domRef'] = domChild;+      } else {+        window['diagnoseError'](logLevel, vdomChild, domChild);+        return false;       }     } else {       if (domChild.nodeType !== Node.ELEMENT_NODE) return false;
miso.cabal view
@@ -1,5 +1,5 @@ name:                miso-version:             1.8.2.0+version:             1.8.3.0 category:            Web, Miso, Data Structures license:             BSD3 license-file:        LICENSE
src/Miso/FFI.hs view
@@ -64,7 +64,7 @@ #else import           Language.Javascript.JSaddle hiding (Success, obj, val) #endif-import           Miso.String+import           Miso.String hiding (elem)  -- | Run given `JSM` action asynchronously, in a separate thread. forkJSM :: JSM () -> JSM ()@@ -92,7 +92,7 @@ -- | Set property on object set :: ToJSVal v => MisoString -> v -> OI.Object -> JSM () set (unpack -> "class") v obj = do-  classSet <- ((JSS.pack "class") `elem`) <$> listProps obj+  classSet <- ((JSS.pack "class") `Prelude.elem`) <$> listProps obj   if classSet     then do       classStr <- fromJSValUnchecked =<< getProp (JSS.pack "class") obj
src/Miso/Html/Types.hs view
@@ -65,7 +65,7 @@ import           Miso.Effect import           Miso.Event import           Miso.FFI-import           Miso.String hiding (reverse)+import           Miso.String hiding (elem, reverse)  -- | Core type for constructing a `VTree`, use this instead of `VTree` directly. data View action