mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 05:21:18 +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
|
||||
var htmx = htmx || (function () {
|
||||
//AMD insanity
|
||||
(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';
|
||||
|
||||
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
||||
@ -565,7 +574,9 @@ var htmx = htmx || (function () {
|
||||
if (ignoreBoostedAnchorCtrlClick(elt, evt)) {
|
||||
return;
|
||||
}
|
||||
if(explicitCancel || shouldCancel(elt)) {}evt.preventDefault();
|
||||
if(explicitCancel || shouldCancel(elt)){
|
||||
evt.preventDefault();
|
||||
}
|
||||
var eventData = getInternalData(evt);
|
||||
var elementData = getInternalData(elt);
|
||||
if (!eventData.handled) {
|
||||
@ -688,12 +699,15 @@ var htmx = htmx || (function () {
|
||||
});
|
||||
if (webSocketSourceElt) {
|
||||
var webSocket = getInternalData(webSocketSourceElt).webSocket;
|
||||
elt.addEventListener(eventName, function () {
|
||||
elt.addEventListener(eventName, function (evt) {
|
||||
var headers = getHeaders(elt, webSocketSourceElt, null, elt);
|
||||
var rawParameters = getInputValues(elt, 'post');
|
||||
var filteredParameters = filterValues(rawParameters, elt);
|
||||
filteredParameters['HEADERS'] = headers;
|
||||
webSocket.send(JSON.stringify(filteredParameters));
|
||||
if(shouldCancel(elt)){
|
||||
evt.preventDefault();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
triggerErrorEvent(elt, "noWebSocketSourceError.htmx");
|
||||
@ -1511,4 +1525,5 @@ var htmx = htmx || (function () {
|
||||
_: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
|
||||
var htmx = htmx || (function () {
|
||||
//AMD insanity
|
||||
(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';
|
||||
|
||||
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
||||
@ -1516,4 +1525,5 @@ var htmx = htmx || (function () {
|
||||
_:internalEval
|
||||
}
|
||||
}
|
||||
)();
|
||||
)()
|
||||
}));
|
@ -1,5 +1,14 @@
|
||||
// noinspection JSUnusedAssignment
|
||||
var htmx = htmx || (function () {
|
||||
//AMD insanity
|
||||
(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';
|
||||
|
||||
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
||||
@ -1516,4 +1525,5 @@ var htmx = htmx || (function () {
|
||||
_:internalEval
|
||||
}
|
||||
}
|
||||
)();
|
||||
)()
|
||||
}));
|
@ -1,5 +1,14 @@
|
||||
// noinspection JSUnusedAssignment
|
||||
var htmx = htmx || (function () {
|
||||
//AMD insanity
|
||||
(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';
|
||||
|
||||
var VERBS = ['get', 'post', 'put', 'delete', 'patch'];
|
||||
@ -1516,4 +1525,5 @@ var htmx = htmx || (function () {
|
||||
_:internalEval
|
||||
}
|
||||
}
|
||||
)();
|
||||
)()
|
||||
}));
|
@ -132,9 +132,9 @@ describe("hx-trigger attribute", function(){
|
||||
}
|
||||
|
||||
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);
|
||||
spec.should.deep.equal(specExamples[specString]);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user