From 51697abff6cf1532c8455a707ff8eeb351cb0a0e Mon Sep 17 00:00:00 2001 From: carson Date: Mon, 25 May 2020 19:46:10 -0700 Subject: [PATCH] revert settle attribute swapping so internals work + hx-ws tests (ugh) --- dist/htmx.js | 47 +++++++-------- dist/htmx.min.js | 2 +- dist/htmx.min.js.gz | Bin 6713 -> 6682 bytes src/htmx.js | 55 +++++++++--------- test/attributes/hx-ws.js | 51 ++++++++++++++++ test/core/ajax.js | 13 +++++ test/index.html | 1 + www/attributes/hx-ws.md | 11 ++-- www/events.md | 7 --- www/js/htmx.js | 47 +++++++-------- www/reference.md | 1 - www/test/0.0.4/src/htmx.js | 47 +++++++-------- www/test/0.0.4/test/attributes/hx-swap-oob.js | 23 ++++++++ www/test/0.0.4/test/attributes/hx-swap.js | 2 +- www/test/0.0.4/test/index.html | 2 +- 15 files changed, 185 insertions(+), 124 deletions(-) create mode 100644 test/attributes/hx-ws.js diff --git a/dist/htmx.js b/dist/htmx.js index 8b16d1ca..cedcc46a 100644 --- a/dist/htmx.js +++ b/dist/htmx.js @@ -346,13 +346,11 @@ return (function () { var target = getDocument().getElementById(child.id); if (target) { var fragment; - if (isInlineSwap(oobValue, target)) { - fragment = getDocument().createDocumentFragment(); - fragment.appendChild(child); - } else { - fragment = child; + fragment = getDocument().createDocumentFragment(); + fragment.appendChild(child); // pulls the child out of the existing fragment + if (!isInlineSwap(oobValue, target)) { + fragment = child; // if this is not an inline swap, we use the content of the node, not the node itself } - fragment.appendChild(child); swap(oobValue, target, target, fragment, settleInfo); } else { child.parentNode.removeChild(child); @@ -370,27 +368,26 @@ return (function () { }); } - function handleAttributes(parentNode, fragment, settleInfo) { - forEach(fragment.querySelectorAll("[id]"), function (newNode) { - var oldNode = parentNode.querySelector(newNode.tagName + "[id=" + newNode.id + "]") - if (oldNode) { - var newAttributes = newNode.cloneNode(); - cloneAttributes(newNode, oldNode); - settleInfo.tasks.push(function () { - cloneAttributes(newNode, newAttributes); - }); - } - }); - } - function insertNodesBefore(parentNode, insertBefore, fragment, settleInfo) { - handleAttributes(parentNode, fragment, settleInfo); while(fragment.childNodes.length > 0){ var child = fragment.firstChild; parentNode.insertBefore(child, insertBefore); if (child.nodeType !== Node.TEXT_NODE) { - triggerEvent(child, 'load.htmx', {}); - processNode(child); + var newAttributes = null; + if (child.id) { + var originalNode = parentNode.querySelector(child.tagName + "[id=" + child.id + "]"); + if (originalNode && originalNode !== parentNode) { + newAttributes = child.cloneNode(); + cloneAttributes(child, originalNode); + } + } + settleInfo.tasks.push(function(){ + if (newAttributes) { + cloneAttributes(child, newAttributes); + } + processNode(child); + triggerEvent(child, 'load.htmx', {}); + }); } } } @@ -757,10 +754,6 @@ return (function () { } function processSSESource(elt, sseSrc) { - var detail = { - config:{withCredentials: true} - }; - triggerEvent(elt, "initSSE.htmx", detail); var source = new EventSource(sseSrc, detail.config); source.onerror = function (e) { triggerErrorEvent(elt, "sseError.htmx", {error:e, source:source}); @@ -1494,7 +1487,7 @@ return (function () { function getMetaConfig() { var element = getDocument().querySelector('meta[name="htmx-config"]'); if (element) { - return JSON.parse(element.content); + return eval(element.content); } else { return null; } diff --git a/dist/htmx.min.js b/dist/htmx.min.js index 74dfccc4..cb7348cb 100644 --- a/dist/htmx.min.js +++ b/dist/htmx.min.js @@ -1 +1 @@ -(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else{e.htmx=t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var t=["get","post","put","delete","patch"];function a(e){if(e==="null"||e==="false"||e===""){return null}else if(e.lastIndexOf("ms")===e.length-2){return parseFloat(e.substr(0,e.length-2))}else if(e.lastIndexOf("s")===e.length-1){return parseFloat(e.substr(0,e.length-1))*1e3}else{return parseFloat(e)}}function u(e,t){return e.getAttribute&&e.getAttribute(t)}function w(e,t){return u(e,t)||u(e,"data-"+t)}function o(e){return e.parentElement}function E(){return document}function l(e,t){if(t(e)){return e}else if(o(e)){return l(o(e),t)}else{return null}}function O(e,t){var r=null;l(e,function(e){return r=w(e,t)});return r}function s(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function r(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function n(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=E().createDocumentFragment()}return i}function f(e){var t=r(e);switch(t){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return n(""+e+"
",1);case"col":return n(""+e+"
",2);case"tr":return n(""+e+"
",2);case"td":case"th":return n(""+e+"
",3);default:return n(e,0)}}function i(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function c(e){return i(e,"Function")}function v(e){return i(e,"Object")}function L(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function h(e){var t=[];if(e){for(var r=0;r=0}function m(e){return E().body.contains(e)}function g(e){return e.split(/\s+/)}function p(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function e(e){return eval(e)}function x(t){var e=htmx.on("load.htmx",function(e){t(e.detail.elt)});return e}function y(){htmx.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function b(e,t){if(t){return e.querySelector(t)}else{return E().body.querySelector(e)}}function S(e,t){if(t){return e.querySelectorAll(t)}else{return E().body.querySelectorAll(e)}}function T(e,t){if(t){setTimeout(function(){T(e)},t)}else{e.parentElement.removeChild(e)}}function H(e,t,r){if(r){setTimeout(function(){H(e,t)},r)}else{e.classList.add(t)}}function q(e,t,r){if(r){setTimeout(function(){q(e,t)},r)}else{e.classList.remove(t)}}function N(e,t){e.classList.toggle(t)}function X(e,t){C(e.parentElement.children,function(e){q(e,t)});H(e,t)}function A(e,t){do{if(e==null||s(e,t))return e}while(e=e&&o(e))}function R(e,t,r){if(c(t)){return{target:E().body,event:e,listener:t}}else{return{target:e,event:t,listener:r}}}function k(t,r,n){tt(function(){var e=R(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=c(r);return e?r:n}function D(t,r,n){tt(function(){var e=R(t,r,n);e.target.removeEventListener(e.event,e.listener)});return c(r)?r:n}function M(e){var t=l(e,function(e){return w(e,"hx-target")!==null});if(t){var r=w(t,"hx-target");if(r==="this"){return t}else if(r.indexOf("closest ")===0){return A(e,r.substr(8))}else{return E().querySelector(r)}}else{var n=L(e);if(n.boosted){return E().body}else{return e}}}function I(t,r){C(t.attributes,function(e){if(!r.hasAttribute(e.name)){t.removeAttribute(e.name)}});C(r.attributes,function(e){t.setAttribute(e.name,e.value)})}function F(e,t){var r=et(t);for(var n=0;n0){var i=r.firstChild;e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE){Oe(i,"load.htmx",{});ye(i)}}}function W(e,t,r){if(e.tagName==="BODY"){return Y(e,t)}else{var n=e.previousSibling;U(o(e),e,t,r);if(n==null){var i=o(e).firstChild}else{var i=n.nextSibling}while(i&&i!=e){r.elts.push(i);i=i.nextSibling}o(e).removeChild(e)}}function z(e,t,r){return U(e,e.firstChild,t,r)}function B(e,t,r){return U(o(e),e,t,r)}function V(e,t,r){return U(e,null,t,r)}function G(e,t,r){return U(o(e),e.nextSibling,t,r)}function Y(e,t,r){var n=e.firstChild;U(e,n,t,r);if(n){while(n.nextSibling){e.removeChild(n.nextSibling)}e.removeChild(n)}}function _(e,t){var r=O(e,"hx-select");if(r){var n=E().createDocumentFragment();C(t.querySelectorAll(r),function(e){n.appendChild(e)});t=n}return t}function K(e,t,r,n,i){switch(e){case"outerHTML":W(r,n,i);return;case"afterbegin":z(r,n,i);return;case"beforebegin":B(r,n,i);return;case"beforeend":V(r,n,i);return;case"afterend":G(r,n,i);return;default:var o=et(t);for(var a=0;ahtmx.config.historyCacheSize){i.shift()}localStorage.setItem("htmx-history-cache",JSON.stringify(i))}function He(e){var t=JSON.parse(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r=200&&this.status<400){Oe(E().body,"historyCacheMissLoad.htmx",i);var e=f(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=Ce();var r=Ye(t);Y(t,e,r);Xe(r.tasks);Le=n}else{we(E().body,"historyCacheMissLoadError.htmx",i)}};e.send()}function Re(e){qe(Le);e=e||location.pathname+location.search;Oe(E().body,"historyRestore.htmx",{path:e});var t=He(e);if(t){var r=f(t.content);var n=Ce();var i=Ye(n);Y(n,r,i);Xe(i.tasks);document.title=t.title;window.scrollTo(0,t.scroll);Le=e}else{Ae(e)}}function ke(e){return O(e,"hx-push-url")==="true"||e.tagName==="A"&&L(e).boosted}function De(e){Ie(e,"add")}function Me(e){Ie(e,"remove")}function Ie(e,t){var r=O(e,"hx-indicator");if(r){var n=E().querySelectorAll(r)}else{n=[e]}C(n,function(e){e.classList[t].call(e.classList,"htmx-request")})}function Fe(e,t){for(var r=0;r0){r["swapStyle"]=n[0];for(var i=1;i=200&&this.status<400){if(this.status===286){ee(a)}if(this.status!==204){if(!Oe(a,"beforeSwap.htmx",S))return;var i=this.response;C(et(a),function(e){i=e.transformResponse(i,f,a)});if(n){qe()}var o=Ve(a);l.classList.add("htmx-swapping");var e=function(){try{var e=Ye(l);Q(o.swapStyle,l,a,i,e);l.classList.remove("htmx-swapping");C(e.elts,function(e){if(e.classList){e.classList.add("htmx-settling")}});Oe(a,"afterSwap.htmx",S);if(p){location.hash=p}var t=function(){C(e.tasks,function(e){e.call()});C(e.elts,function(e){if(e.classList){e.classList.remove("htmx-settling")}});if(n){Ne(r||u)}Oe(a,"afterSettle.htmx",S)};if(o.settleDelay>0){setTimeout(t,o.settleDelay)}else{t()}}catch(e){we(a,"swapError.htmx",S);throw e}};if(o.swapDelay>0){setTimeout(e,o.swapDelay)}else{e()}}}else{we(a,"responseError.htmx",S)}}catch(e){S["exception"]=e;we(a,"onLoadError.htmx",S);throw e}finally{Me(a);Oe(a,"afterRequest.htmx",S);Oe(a,"afterOnLoad.htmx",S);s()}};f.onerror=function(){Me(a);we(a,"afterRequest.htmx",S);we(a,"sendError.htmx",S);s()};if(!Oe(a,"beforeRequest.htmx",S))return s();De(a);f.send(e==="get"?null:Ge(f,a,h))}var Ke={};function Qe(){return{onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function Ze(e,t){Ke[e]=p(Qe(),t)}function $e(e){delete Ke[e]}function et(e,r){if(e==null){return r}if(r==null){r=[]}var t=w(e,"hx-ext");if(t){C(t.split(","),function(e){e=e.replace(/ /g,"");var t=Ke[e];if(t&&r.indexOf(t)<0){r.push(t)}})}return et(o(e),r)}function tt(e){if(E().readyState!=="loading"){e()}else{E().addEventListener("DOMContentLoaded",e)}}(function(){var e=rt();if(e===null||e.includeIndicatorStyles!==false){E().head.insertAdjacentHTML("beforeend","")}})();function rt(){var e=E().querySelector('meta[name="htmx-config"]');if(e){return JSON.parse(e.content)}else{return null}}function nt(){var e=rt();if(e){htmx.config=p(htmx.config,e)}}tt(function(){nt();var e=E().body;ye(e);Oe(e,"load.htmx",{});window.onpopstate=function(){Re()}});return{onLoad:x,process:ye,on:k,off:D,trigger:Oe,find:b,findAll:S,closest:A,remove:T,addClass:H,removeClass:q,toggleClass:N,takeClass:X,defineExtension:Ze,removeExtension:$e,logAll:y,logger:null,config:{historyEnabled:true,historyCacheSize:10,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:100,includeIndicatorStyles:true},parseInterval:a,_:e}}()}); \ No newline at end of file +(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else{e.htmx=t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var t=["get","post","put","delete","patch"];function a(e){if(e==="null"||e==="false"||e===""){return null}else if(e.lastIndexOf("ms")===e.length-2){return parseFloat(e.substr(0,e.length-2))}else if(e.lastIndexOf("s")===e.length-1){return parseFloat(e.substr(0,e.length-1))*1e3}else{return parseFloat(e)}}function u(e,t){return e.getAttribute&&e.getAttribute(t)}function w(e,t){return u(e,t)||u(e,"data-"+t)}function o(e){return e.parentElement}function E(){return document}function l(e,t){if(t(e)){return e}else if(o(e)){return l(o(e),t)}else{return null}}function O(e,t){var r=null;l(e,function(e){return r=w(e,t)});return r}function f(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function r(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function n(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=E().createDocumentFragment()}return i}function s(e){var t=r(e);switch(t){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return n(""+e+"
",1);case"col":return n(""+e+"
",2);case"tr":return n(""+e+"
",2);case"td":case"th":return n(""+e+"
",3);default:return n(e,0)}}function i(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function c(e){return i(e,"Function")}function v(e){return i(e,"Object")}function L(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function h(e){var t=[];if(e){for(var r=0;r=0}function m(e){return E().body.contains(e)}function g(e){return e.split(/\s+/)}function p(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function e(e){return eval(e)}function x(t){var e=htmx.on("load.htmx",function(e){t(e.detail.elt)});return e}function y(){htmx.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function b(e,t){if(t){return e.querySelector(t)}else{return E().body.querySelector(e)}}function S(e,t){if(t){return e.querySelectorAll(t)}else{return E().body.querySelectorAll(e)}}function T(e,t){if(t){setTimeout(function(){T(e)},t)}else{e.parentElement.removeChild(e)}}function H(e,t,r){if(r){setTimeout(function(){H(e,t)},r)}else{e.classList.add(t)}}function q(e,t,r){if(r){setTimeout(function(){q(e,t)},r)}else{e.classList.remove(t)}}function N(e,t){e.classList.toggle(t)}function X(e,t){C(e.parentElement.children,function(e){q(e,t)});H(e,t)}function A(e,t){do{if(e==null||f(e,t))return e}while(e=e&&o(e))}function R(e,t,r){if(c(t)){return{target:E().body,event:e,listener:t}}else{return{target:e,event:t,listener:r}}}function k(t,r,n){et(function(){var e=R(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=c(r);return e?r:n}function D(t,r,n){et(function(){var e=R(t,r,n);e.target.removeEventListener(e.event,e.listener)});return c(r)?r:n}function M(e){var t=l(e,function(e){return w(e,"hx-target")!==null});if(t){var r=w(t,"hx-target");if(r==="this"){return t}else if(r.indexOf("closest ")===0){return A(e,r.substr(8))}else{return E().querySelector(r)}}else{var n=L(e);if(n.boosted){return E().body}else{return e}}}function I(t,r){C(t.attributes,function(e){if(!r.hasAttribute(e.name)){t.removeAttribute(e.name)}});C(r.attributes,function(e){t.setAttribute(e.name,e.value)})}function F(e,t){var r=$e(t);for(var n=0;n0){var i=r.firstChild;e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE){var o=null;if(i.id){var a=e.querySelector(i.tagName+"[id="+i.id+"]");if(a&&a!==e){o=i.cloneNode();I(i,a)}}n.tasks.push(function(){if(o){I(i,o)}xe(i);Ee(i,"load.htmx",{})})}}}function U(e,t,r){if(e.tagName==="BODY"){return G(e,t)}else{var n=e.previousSibling;J(o(e),e,t,r);if(n==null){var i=o(e).firstChild}else{var i=n.nextSibling}while(i&&i!=e){r.elts.push(i);i=i.nextSibling}o(e).removeChild(e)}}function W(e,t,r){return J(e,e.firstChild,t,r)}function z(e,t,r){return J(o(e),e,t,r)}function B(e,t,r){return J(e,null,t,r)}function V(e,t,r){return J(o(e),e.nextSibling,t,r)}function G(e,t,r){var n=e.firstChild;J(e,n,t,r);if(n){while(n.nextSibling){e.removeChild(n.nextSibling)}e.removeChild(n)}}function Y(e,t){var r=O(e,"hx-select");if(r){var n=E().createDocumentFragment();C(t.querySelectorAll(r),function(e){n.appendChild(e)});t=n}return t}function _(e,t,r,n,i){switch(e){case"outerHTML":U(r,n,i);return;case"afterbegin":W(r,n,i);return;case"beforebegin":z(r,n,i);return;case"beforeend":B(r,n,i);return;case"afterend":V(r,n,i);return;default:var o=$e(t);for(var a=0;ahtmx.config.historyCacheSize){i.shift()}localStorage.setItem("htmx-history-cache",JSON.stringify(i))}function Te(e){var t=JSON.parse(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r=200&&this.status<400){Ee(E().body,"historyCacheMissLoad.htmx",i);var e=s(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=Le();var r=Ge(t);G(t,e,r);Ne(r.tasks);Oe=n}else{Se(E().body,"historyCacheMissLoadError.htmx",i)}};e.send()}function Ae(e){He(Oe);e=e||location.pathname+location.search;Ee(E().body,"historyRestore.htmx",{path:e});var t=Te(e);if(t){var r=s(t.content);var n=Le();var i=Ge(n);G(n,r,i);Ne(i.tasks);document.title=t.title;window.scrollTo(0,t.scroll);Oe=e}else{Xe(e)}}function Re(e){return O(e,"hx-push-url")==="true"||e.tagName==="A"&&L(e).boosted}function ke(e){Me(e,"add")}function De(e){Me(e,"remove")}function Me(e,t){var r=O(e,"hx-indicator");if(r){var n=E().querySelectorAll(r)}else{n=[e]}C(n,function(e){e.classList[t].call(e.classList,"htmx-request")})}function Ie(e,t){for(var r=0;r0){r["swapStyle"]=n[0];for(var i=1;i=200&&this.status<400){if(this.status===286){$(a)}if(this.status!==204){if(!Ee(a,"beforeSwap.htmx",S))return;var i=this.response;C($e(a),function(e){i=e.transformResponse(i,s,a)});if(n){He()}var o=Be(a);l.classList.add("htmx-swapping");var e=function(){try{var e=Ge(l);K(o.swapStyle,l,a,i,e);l.classList.remove("htmx-swapping");C(e.elts,function(e){if(e.classList){e.classList.add("htmx-settling")}});Ee(a,"afterSwap.htmx",S);if(p){location.hash=p}var t=function(){C(e.tasks,function(e){e.call()});C(e.elts,function(e){if(e.classList){e.classList.remove("htmx-settling")}});if(n){qe(r||u)}Ee(a,"afterSettle.htmx",S)};if(o.settleDelay>0){setTimeout(t,o.settleDelay)}else{t()}}catch(e){Se(a,"swapError.htmx",S);throw e}};if(o.swapDelay>0){setTimeout(e,o.swapDelay)}else{e()}}}else{Se(a,"responseError.htmx",S)}}catch(e){S["exception"]=e;Se(a,"onLoadError.htmx",S);throw e}finally{De(a);Ee(a,"afterRequest.htmx",S);Ee(a,"afterOnLoad.htmx",S);f()}};s.onerror=function(){De(a);Se(a,"afterRequest.htmx",S);Se(a,"sendError.htmx",S);f()};if(!Ee(a,"beforeRequest.htmx",S))return f();ke(a);s.send(e==="get"?null:Ve(s,a,h))}var _e={};function Ke(){return{onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function Qe(e,t){_e[e]=p(Ke(),t)}function Ze(e){delete _e[e]}function $e(e,r){if(e==null){return r}if(r==null){r=[]}var t=w(e,"hx-ext");if(t){C(t.split(","),function(e){e=e.replace(/ /g,"");var t=_e[e];if(t&&r.indexOf(t)<0){r.push(t)}})}return $e(o(e),r)}function et(e){if(E().readyState!=="loading"){e()}else{E().addEventListener("DOMContentLoaded",e)}}(function(){var e=tt();if(e===null||e.includeIndicatorStyles!==false){E().head.insertAdjacentHTML("beforeend","")}})();function tt(){var e=E().querySelector('meta[name="htmx-config"]');if(e){return eval(e.content)}else{return null}}function rt(){var e=tt();if(e){htmx.config=p(htmx.config,e)}}et(function(){rt();var e=E().body;xe(e);Ee(e,"load.htmx",{});window.onpopstate=function(){Ae()}});return{onLoad:x,process:xe,on:k,off:D,trigger:Ee,find:b,findAll:S,closest:A,remove:T,addClass:H,removeClass:q,toggleClass:N,takeClass:X,defineExtension:Qe,removeExtension:Ze,logAll:y,logger:null,config:{historyEnabled:true,historyCacheSize:10,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:100,includeIndicatorStyles:true},parseInterval:a,_:e}}()}); \ No newline at end of file diff --git a/dist/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hkzyz*|8fZWC8mwWFIw&^x3Cn z*_3a6?Q+NxDV$QG+3fBYPDJIXP&0^lFi@Usspb3P#n)Rshe3t3_4?-a(KTi~Wu<+j zVVXkk7U*MtZwrg@AvT%r`?}P4{#5~!e`)=HjZa4MOWC61ga(AZ>#5@&a^_bY zgM^>u)v^2~o!&-eM%&dB`p&zl+~FUrg>I37iz>Qe-AK99l|ME@2F_=*Fgjx@FprEY zsD+8TTGwj|YLXD)8#@TUjcdiqn;mF{-!$k{D)R*OYGvl&@oN_r(B$8lpZqpM%eVlg zJewJaLp7Ixs{eu9tofw(imKdd$lw~jD$sqaZ> z0|E^&jA-<5xU{Y)sEWMwY$jvK^B|_|YMLeF*$)$*kJ2EM@fcoSk&2^W#Rv={xW+xr Pp2L*C><${j)Jp&W{3R78 diff --git a/src/htmx.js b/src/htmx.js index efd04259..236e8bdc 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -368,23 +368,26 @@ return (function () { }); } + function handleAttributes(parentNode, fragment, settleInfo) { + forEach(fragment.querySelectorAll("[id]"), function (newNode) { + var oldNode = parentNode.querySelector(newNode.tagName + "[id=" + newNode.id + "]") + if (oldNode && oldNode !== parentNode) { + var newAttributes = newNode.cloneNode(); + cloneAttributes(newNode, oldNode); + settleInfo.tasks.push(function () { + cloneAttributes(newNode, newAttributes); + }); + } + }); + } + function insertNodesBefore(parentNode, insertBefore, fragment, settleInfo) { + handleAttributes(parentNode, fragment, settleInfo); while(fragment.childNodes.length > 0){ var child = fragment.firstChild; parentNode.insertBefore(child, insertBefore); if (child.nodeType !== Node.TEXT_NODE) { - var newAttributes = null; - if (child.id) { - var originalNode = parentNode.querySelector(child.tagName + "[id=" + child.id + "]"); - if (originalNode && originalNode !== parentNode) { - newAttributes = child.cloneNode(); - cloneAttributes(child, originalNode); - } - } settleInfo.tasks.push(function(){ - if (newAttributes) { - cloneAttributes(child, newAttributes); - } processNode(child); triggerEvent(child, 'load.htmx', {}); }); @@ -663,21 +666,17 @@ return (function () { var values = info.split(","); for (var i = 0; i < values.length; i++) { var value = removeWhiteSpace(values[i]); - if (value.indexOf("source:") === 0) { + if (value.indexOf("source ") === 0) { processWebSocketSource(elt, value.substr(7)); } - if (value.indexOf("send:") === 0) { - processWebSocketSend(elt, value.substr(5)); + if (value === "send") { + processWebSocketSend(elt); } } } function processWebSocketSource(elt, wssSource) { - var detail = { - protocols:[] - }; - triggerEvent(elt, "initWebSocket.htmx", detail); - var socket = new WebSocket("wss:" + wssSource, detail.protocols); + var socket = htmx.createWebSocket(wssSource); socket.onerror = function (e) { triggerErrorEvent(elt, "wsError.htmx", {error:e, socket:socket}); maybeCloseWebSocketSource(elt); @@ -712,13 +711,13 @@ return (function () { } } - function processWebSocketSend(elt, eventName) { + function processWebSocketSend(elt) { var webSocketSourceElt = getClosestMatch(elt, function (parent) { return getInternalData(parent).webSocket != null; }); if (webSocketSourceElt) { var webSocket = getInternalData(webSocketSourceElt).webSocket; - elt.addEventListener(eventName, function (evt) { + elt.addEventListener(getTriggerSpecs(elt)[0].trigger, function (evt) { var headers = getHeaders(elt, webSocketSourceElt, null, elt); var rawParameters = getInputValues(elt, 'post'); var filteredParameters = filterValues(rawParameters, elt); @@ -754,11 +753,7 @@ return (function () { } function processSSESource(elt, sseSrc) { - var detail = { - config:{withCredentials: true} - }; - triggerEvent(elt, "initSSE.htmx", detail); - var source = new EventSource(sseSrc, detail.config); + var source = htmx.createEventSource(sseSrc); source.onerror = function (e) { triggerErrorEvent(elt, "sseError.htmx", {error:e, source:source}); maybeCloseSSESource(elt); @@ -1543,7 +1538,13 @@ return (function () { includeIndicatorStyles:true }, parseInterval:parseInterval, - _:internalEval + _:internalEval, + createEventSource: function(url){ + return new EventSource(url, {withCredentials:true}) + }, + createWebSocket: function(url){ + return new WebSocket(url, []); + } } } )() diff --git a/test/attributes/hx-ws.js b/test/attributes/hx-ws.js new file mode 100644 index 00000000..a1988e4f --- /dev/null +++ b/test/attributes/hx-ws.js @@ -0,0 +1,51 @@ +describe("hx-ws attribute", function() { + + function mockWebsocket() { + var listener; + var lastSent; + var mockSocket = { + addEventListener : function(message, l) { + listener = l; + }, + write : function(content) { + return listener({data:content}); + }, + send : function(data) { + lastSent = data; + }, + getLastSent : function() { + return lastSent; + } + }; + return mockSocket; + } + + beforeEach(function () { + this.server = makeServer(); + var socket = mockWebsocket(); + this.socket = socket; + clearWorkArea(); + htmx.createWebSocket = function(){ return socket }; + }); + afterEach(function () { + this.server.restore(); + clearWorkArea(); + }); + + it('handles a basic call back', function () { + var div = make('
div1
div2
'); + this.socket.write("
replaced
") + byId("d1").innerHTML.should.equal("replaced"); + byId("d2").innerHTML.should.equal("div2"); + }) + + it('handles a basic send', function () { + var div = make('
div1
'); + byId("d1").click(); + var lastSent = this.socket.getLastSent(); + var data = JSON.parse(lastSent); + data.HEADERS["X-HX-Request"].should.equal("true"); + }) + +}); + diff --git a/test/core/ajax.js b/test/core/ajax.js index 4f5bc1fd..eb56ebbb 100644 --- a/test/core/ajax.js +++ b/test/core/ajax.js @@ -305,6 +305,19 @@ describe("Core htmx AJAX Tests", function(){ div.innerHTML.should.equal("
foo
"); }); + it('properly settles attributes on interior elements', function(done) + { + this.server.respondWith("GET", "/test", "
"); + var div = make("
"); + div.click(); + this.server.respond(); + should.equal(byId("d1").getAttribute("foo"), null); + setTimeout(function () { + should.equal(byId("d1").getAttribute("foo"), "bar"); + done(); + }, 20); + }); + it('properly handles checkbox inputs', function() { var values; diff --git a/test/index.html b/test/index.html index ae78f4e9..fd0de65a 100644 --- a/test/index.html +++ b/test/index.html @@ -78,6 +78,7 @@ + diff --git a/www/attributes/hx-ws.md b/www/attributes/hx-ws.md index 66406577..3e966607 100644 --- a/www/attributes/hx-ws.md +++ b/www/attributes/hx-ws.md @@ -8,24 +8,25 @@ title: htmx - hx-ws The `hx-ws` allows you to work with [Web Sockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications) directly from HTML. The value of the attribute can be one or more of the following, separated by commas: -* `source:` - A URL to establish an `WebSocket` against (NB: do not include the `wss:` protocol prefix) -* `send:` - Sends a message to the nearest websocket +* `source ` - A URL to establish an `WebSocket` against (NB: include the `wss:` protocol prefix) +* `send` - Sends a message to the nearest websocket based on the trigger value for the element (either the natural event +of the event specified by [`hx-trigger`]) Here is an example: ```html -
+
...
-
+
``` This example establishes a WebSocket to the `chatroom` end point. Content that is send down from the websocket will -be parsed as HTML and swapped in by the `id` property, similar to [Out of Band Swaps](/attributes/hx-swap-oob). +be parsed as HTML and swapped in by the `id` property, using the same logis as [Out of Band Swaps](/attributes/hx-swap-oob). The form uses the `send:` syntax to indicate that when it is submitted, the form values should be serialized as JSON and send to the nearest enclosing `WebSocket`. diff --git a/www/events.md b/www/events.md index 41fc7c7c..b8b1a986 100644 --- a/www/events.md +++ b/www/events.md @@ -118,13 +118,6 @@ This event is triggered when htmx handles a history restoration action * `detail.path` - the path and query of the page being restored * `detail.historyElt` - the history element being restored into -### Event - [`initSSE.htmx`](#initSSE.htmx) - -This event is triggered when htmx initializes a new SSE source. It can be used -to [configure the source](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/EventSource). - -Note that by default `withCredentials` will be set to `true` in the configuration. - ##### Details * `detail.config` - the config that will be passed to the `EventSource` contstructor diff --git a/www/js/htmx.js b/www/js/htmx.js index 8b16d1ca..cedcc46a 100644 --- a/www/js/htmx.js +++ b/www/js/htmx.js @@ -346,13 +346,11 @@ return (function () { var target = getDocument().getElementById(child.id); if (target) { var fragment; - if (isInlineSwap(oobValue, target)) { - fragment = getDocument().createDocumentFragment(); - fragment.appendChild(child); - } else { - fragment = child; + fragment = getDocument().createDocumentFragment(); + fragment.appendChild(child); // pulls the child out of the existing fragment + if (!isInlineSwap(oobValue, target)) { + fragment = child; // if this is not an inline swap, we use the content of the node, not the node itself } - fragment.appendChild(child); swap(oobValue, target, target, fragment, settleInfo); } else { child.parentNode.removeChild(child); @@ -370,27 +368,26 @@ return (function () { }); } - function handleAttributes(parentNode, fragment, settleInfo) { - forEach(fragment.querySelectorAll("[id]"), function (newNode) { - var oldNode = parentNode.querySelector(newNode.tagName + "[id=" + newNode.id + "]") - if (oldNode) { - var newAttributes = newNode.cloneNode(); - cloneAttributes(newNode, oldNode); - settleInfo.tasks.push(function () { - cloneAttributes(newNode, newAttributes); - }); - } - }); - } - function insertNodesBefore(parentNode, insertBefore, fragment, settleInfo) { - handleAttributes(parentNode, fragment, settleInfo); while(fragment.childNodes.length > 0){ var child = fragment.firstChild; parentNode.insertBefore(child, insertBefore); if (child.nodeType !== Node.TEXT_NODE) { - triggerEvent(child, 'load.htmx', {}); - processNode(child); + var newAttributes = null; + if (child.id) { + var originalNode = parentNode.querySelector(child.tagName + "[id=" + child.id + "]"); + if (originalNode && originalNode !== parentNode) { + newAttributes = child.cloneNode(); + cloneAttributes(child, originalNode); + } + } + settleInfo.tasks.push(function(){ + if (newAttributes) { + cloneAttributes(child, newAttributes); + } + processNode(child); + triggerEvent(child, 'load.htmx', {}); + }); } } } @@ -757,10 +754,6 @@ return (function () { } function processSSESource(elt, sseSrc) { - var detail = { - config:{withCredentials: true} - }; - triggerEvent(elt, "initSSE.htmx", detail); var source = new EventSource(sseSrc, detail.config); source.onerror = function (e) { triggerErrorEvent(elt, "sseError.htmx", {error:e, source:source}); @@ -1494,7 +1487,7 @@ return (function () { function getMetaConfig() { var element = getDocument().querySelector('meta[name="htmx-config"]'); if (element) { - return JSON.parse(element.content); + return eval(element.content); } else { return null; } diff --git a/www/reference.md b/www/reference.md index 0be4f282..6aa65b52 100644 --- a/www/reference.md +++ b/www/reference.md @@ -82,7 +82,6 @@ title: htmx - Attributes | [`historyCacheMissLoad.htmx`](/events#historyCacheMissLoad.htmx) | triggered on a succesful remote retrieval | [`historyRestore.htmx`](/events#historyRestore.htmx) | triggered when htmx handles a history restoration action | [`beforeHistorySave.htmx`](/events#beforeHistorySave.htmx) | triggered before content is saved to the history cache -| [`initSSE.htmx`](/events#initSSE.htmx) | triggered when a new Server Sent Event source is created | [`load.htmx`](/events#load.htmx) | triggered when new content is added to the DOM | [`noSSESourceError.htmx`](/events#noSSESourceError.htmx) | triggered when an element refers to a SSE event in its trigger, but no parent SSE source has been defined | [`onLoadError.htmx`](/events#onLoadError.htmx) | triggered when an exception occurs during the onLoad handling in htmx diff --git a/www/test/0.0.4/src/htmx.js b/www/test/0.0.4/src/htmx.js index 8b16d1ca..cedcc46a 100644 --- a/www/test/0.0.4/src/htmx.js +++ b/www/test/0.0.4/src/htmx.js @@ -346,13 +346,11 @@ return (function () { var target = getDocument().getElementById(child.id); if (target) { var fragment; - if (isInlineSwap(oobValue, target)) { - fragment = getDocument().createDocumentFragment(); - fragment.appendChild(child); - } else { - fragment = child; + fragment = getDocument().createDocumentFragment(); + fragment.appendChild(child); // pulls the child out of the existing fragment + if (!isInlineSwap(oobValue, target)) { + fragment = child; // if this is not an inline swap, we use the content of the node, not the node itself } - fragment.appendChild(child); swap(oobValue, target, target, fragment, settleInfo); } else { child.parentNode.removeChild(child); @@ -370,27 +368,26 @@ return (function () { }); } - function handleAttributes(parentNode, fragment, settleInfo) { - forEach(fragment.querySelectorAll("[id]"), function (newNode) { - var oldNode = parentNode.querySelector(newNode.tagName + "[id=" + newNode.id + "]") - if (oldNode) { - var newAttributes = newNode.cloneNode(); - cloneAttributes(newNode, oldNode); - settleInfo.tasks.push(function () { - cloneAttributes(newNode, newAttributes); - }); - } - }); - } - function insertNodesBefore(parentNode, insertBefore, fragment, settleInfo) { - handleAttributes(parentNode, fragment, settleInfo); while(fragment.childNodes.length > 0){ var child = fragment.firstChild; parentNode.insertBefore(child, insertBefore); if (child.nodeType !== Node.TEXT_NODE) { - triggerEvent(child, 'load.htmx', {}); - processNode(child); + var newAttributes = null; + if (child.id) { + var originalNode = parentNode.querySelector(child.tagName + "[id=" + child.id + "]"); + if (originalNode && originalNode !== parentNode) { + newAttributes = child.cloneNode(); + cloneAttributes(child, originalNode); + } + } + settleInfo.tasks.push(function(){ + if (newAttributes) { + cloneAttributes(child, newAttributes); + } + processNode(child); + triggerEvent(child, 'load.htmx', {}); + }); } } } @@ -757,10 +754,6 @@ return (function () { } function processSSESource(elt, sseSrc) { - var detail = { - config:{withCredentials: true} - }; - triggerEvent(elt, "initSSE.htmx", detail); var source = new EventSource(sseSrc, detail.config); source.onerror = function (e) { triggerErrorEvent(elt, "sseError.htmx", {error:e, source:source}); @@ -1494,7 +1487,7 @@ return (function () { function getMetaConfig() { var element = getDocument().querySelector('meta[name="htmx-config"]'); if (element) { - return JSON.parse(element.content); + return eval(element.content); } else { return null; } diff --git a/www/test/0.0.4/test/attributes/hx-swap-oob.js b/www/test/0.0.4/test/attributes/hx-swap-oob.js index 2d84daa5..513159c5 100644 --- a/www/test/0.0.4/test/attributes/hx-swap-oob.js +++ b/www/test/0.0.4/test/attributes/hx-swap-oob.js @@ -48,5 +48,28 @@ describe("hx-swap-oob attribute", function () { byId("d1").innerHTML.should.equal("Swapped"); }) + it('handles outerHTML response properly', function () { + this.server.respondWith("GET", "/test", "Clicked
Swapped
"); + var div = make('
click me
'); + make('
'); + div.click(); + this.server.respond(); + byId("d1").getAttribute("foo").should.equal("bar"); + div.innerHTML.should.equal("Clicked"); + byId("d1").innerHTML.should.equal("Swapped"); + }) + + it('handles innerHTML response properly', function () { + this.server.respondWith("GET", "/test", "Clicked
Swapped
"); + var div = make('
click me
'); + make('
'); + div.click(); + this.server.respond(); + should.equal(byId("d1").getAttribute("foo"), null); + div.innerHTML.should.equal("Clicked"); + byId("d1").innerHTML.should.equal("Swapped"); + }) + + }); diff --git a/www/test/0.0.4/test/attributes/hx-swap.js b/www/test/0.0.4/test/attributes/hx-swap.js index 39b04edb..2e484b45 100644 --- a/www/test/0.0.4/test/attributes/hx-swap.js +++ b/www/test/0.0.4/test/attributes/hx-swap.js @@ -211,7 +211,7 @@ describe("hx-swap attribute", function(){ swapSpec(make("
")).swapStyle.should.equal("innerHTML") swapSpec(make("
")).swapStyle.should.equal("innerHTML") swapSpec(make("
")).swapDelay.should.equal(0) - swapSpec(make("
")).settleDelay.should.equal(100) + swapSpec(make("
")).settleDelay.should.equal(0) // set to 0 in tests swapSpec(make("
")).swapDelay.should.equal(10) swapSpec(make("
")).settleDelay.should.equal(10) swapSpec(make("
")).swapDelay.should.equal(10) diff --git a/www/test/0.0.4/test/index.html b/www/test/0.0.4/test/index.html index f27666bd..ae78f4e9 100644 --- a/www/test/0.0.4/test/index.html +++ b/www/test/0.0.4/test/index.html @@ -9,7 +9,7 @@ - +