mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
attempt at playing nice with the insanity of javascript loaders
This commit is contained in:
parent
cbe8cd9fce
commit
7092576aad
25
dist/htmx.js
vendored
25
dist/htmx.js
vendored
@ -1,5 +1,14 @@
|
|||||||
// noinspection JSUnusedAssignment
|
//AMD insanity
|
||||||
var htmx = htmx || (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define([], factory);
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
root.htmx = factory();
|
||||||
|
}
|
||||||
|
}(typeof self !== 'undefined' ? self : this, function () {
|
||||||
|
return (function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
||||||
@ -565,7 +574,9 @@ var htmx = htmx || (function () {
|
|||||||
if (ignoreBoostedAnchorCtrlClick(elt, evt)) {
|
if (ignoreBoostedAnchorCtrlClick(elt, evt)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(explicitCancel || shouldCancel(elt)) {}evt.preventDefault();
|
if(explicitCancel || shouldCancel(elt)){
|
||||||
|
evt.preventDefault();
|
||||||
|
}
|
||||||
var eventData = getInternalData(evt);
|
var eventData = getInternalData(evt);
|
||||||
var elementData = getInternalData(elt);
|
var elementData = getInternalData(elt);
|
||||||
if (!eventData.handled) {
|
if (!eventData.handled) {
|
||||||
@ -688,12 +699,15 @@ var htmx = htmx || (function () {
|
|||||||
});
|
});
|
||||||
if (webSocketSourceElt) {
|
if (webSocketSourceElt) {
|
||||||
var webSocket = getInternalData(webSocketSourceElt).webSocket;
|
var webSocket = getInternalData(webSocketSourceElt).webSocket;
|
||||||
elt.addEventListener(eventName, function () {
|
elt.addEventListener(eventName, function (evt) {
|
||||||
var headers = getHeaders(elt, webSocketSourceElt, null, elt);
|
var headers = getHeaders(elt, webSocketSourceElt, null, elt);
|
||||||
var rawParameters = getInputValues(elt, 'post');
|
var rawParameters = getInputValues(elt, 'post');
|
||||||
var filteredParameters = filterValues(rawParameters, elt);
|
var filteredParameters = filterValues(rawParameters, elt);
|
||||||
filteredParameters['HEADERS'] = headers;
|
filteredParameters['HEADERS'] = headers;
|
||||||
webSocket.send(JSON.stringify(filteredParameters));
|
webSocket.send(JSON.stringify(filteredParameters));
|
||||||
|
if(shouldCancel(elt)){
|
||||||
|
evt.preventDefault();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
triggerErrorEvent(elt, "noWebSocketSourceError.htmx");
|
triggerErrorEvent(elt, "noWebSocketSourceError.htmx");
|
||||||
@ -1511,4 +1525,5 @@ var htmx = htmx || (function () {
|
|||||||
_:internalEval
|
_:internalEval
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)();
|
)()
|
||||||
|
}));
|
2
dist/htmx.min.js
vendored
2
dist/htmx.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/htmx.min.js.gz
vendored
BIN
dist/htmx.min.js.gz
vendored
Binary file not shown.
16
src/htmx.js
16
src/htmx.js
@ -1,5 +1,14 @@
|
|||||||
// noinspection JSUnusedAssignment
|
//AMD insanity
|
||||||
var htmx = htmx || (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define([], factory);
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
root.htmx = factory();
|
||||||
|
}
|
||||||
|
}(typeof self !== 'undefined' ? self : this, function () {
|
||||||
|
return (function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
||||||
@ -1516,4 +1525,5 @@ var htmx = htmx || (function () {
|
|||||||
_:internalEval
|
_:internalEval
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)();
|
)()
|
||||||
|
}));
|
@ -1,5 +1,14 @@
|
|||||||
// noinspection JSUnusedAssignment
|
//AMD insanity
|
||||||
var htmx = htmx || (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define([], factory);
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
root.htmx = factory();
|
||||||
|
}
|
||||||
|
}(typeof self !== 'undefined' ? self : this, function () {
|
||||||
|
return (function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
||||||
@ -1516,4 +1525,5 @@ var htmx = htmx || (function () {
|
|||||||
_:internalEval
|
_:internalEval
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)();
|
)()
|
||||||
|
}));
|
@ -1,5 +1,14 @@
|
|||||||
// noinspection JSUnusedAssignment
|
//AMD insanity
|
||||||
var htmx = htmx || (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define([], factory);
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
root.htmx = factory();
|
||||||
|
}
|
||||||
|
}(typeof self !== 'undefined' ? self : this, function () {
|
||||||
|
return (function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
||||||
@ -1516,4 +1525,5 @@ var htmx = htmx || (function () {
|
|||||||
_:internalEval
|
_:internalEval
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)();
|
)()
|
||||||
|
}));
|
@ -132,9 +132,9 @@ describe("hx-trigger attribute", function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var specString in specExamples) {
|
for (var specString in specExamples) {
|
||||||
it("parses " + specString + "`, function()
|
it("parses " + specString, function()
|
||||||
{
|
{
|
||||||
var div = make("<div hx-trigger=" + specString + "></div>`);
|
var div = make("<div hx-trigger=" + specString + "></div>");
|
||||||
var spec = htmx._('getTriggerSpecs')(div);
|
var spec = htmx._('getTriggerSpecs')(div);
|
||||||
spec.should.deep.equal(specExamples[specString]);
|
spec.should.deep.equal(specExamples[specString]);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user