Merge branch 'master' into dev

This commit is contained in:
carson 2021-05-10 09:37:25 -06:00
commit 13acf899d7
5 changed files with 26 additions and 20 deletions

View File

@ -60,6 +60,7 @@ htmx is the successor to [intercooler.js](http://intercoolerjs.org)
* if you are adding a feature, consider doing it as an [extension](https://htmx.org/extensions) instead to
keep the core htmx code tidy
* development pull requests should be against the `dev` branch, docs fixes can be made directly against `master`
* No time? Then [become a sponsor](https://github.com/sponsors/bigskysoftware#sponsors)
## haiku

26
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "htmx.org",
"version": "1.2.1",
"version": "1.3.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -2790,9 +2790,9 @@
"dev": true
},
"handlebars": {
"version": "4.7.6",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz",
"integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==",
"version": "4.7.7",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
"integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
"dev": true,
"requires": {
"minimist": "^1.2.5",
@ -2906,9 +2906,9 @@
"dev": true
},
"hosted-git-info": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
"version": "2.8.9",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true
},
"http-errors": {
@ -3659,9 +3659,9 @@
}
},
"lodash": {
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"lodash.debounce": {
@ -6499,9 +6499,9 @@
"dev": true
},
"ua-parser-js": {
"version": "0.7.23",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.23.tgz",
"integrity": "sha512-m4hvMLxgGHXG3O3fQVAyyAQpZzDOvwnhOTjYz5Xmr7r/+LpkNy3vJXdVRWgd1TkAb7NGROZuSy96CrlNVjA7KA==",
"version": "0.7.28",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.28.tgz",
"integrity": "sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g==",
"dev": true
},
"uc.micro": {

View File

@ -49,6 +49,7 @@ return (function () {
swappingClass:'htmx-swapping',
allowEval:true,
attributesToSettle:["class", "style", "width", "height"],
withCredentials:false,
wsReconnectDelay: 'full-jitter',
disableSelector: "[hx-disable], [data-hx-disable]",
},
@ -581,7 +582,7 @@ return (function () {
function swapOuterHTML(target, fragment, settleInfo) {
if (target.tagName === "BODY") {
return swapInnerHTML(target, fragment);
return swapInnerHTML(target, fragment, settleInfo);
} else {
var eltBeforeNewContent = target.previousSibling;
insertNodesBefore(parentElt(target), target, fragment, settleInfo);
@ -1016,10 +1017,12 @@ return (function () {
}
if (triggerSpec.throttle) {
elementData.throttle = setTimeout(function(){
if(!elementData.throttle) {
issueAjaxRequest(verb, path, elt, evt);
elementData.throttle = null;
}, triggerSpec.throttle);
elementData.throttle = setTimeout(function(){
elementData.throttle = null;
}, triggerSpec.throttle);
}
} else if (triggerSpec.delay) {
elementData.delayed = setTimeout(function(){
issueAjaxRequest(verb, path, elt, evt);
@ -2145,6 +2148,7 @@ return (function () {
}
xhr.overrideMimeType("text/html");
xhr.withCredentials = htmx.config.withCredentials;
// request headers
for (var header in headers) {

View File

@ -98,6 +98,7 @@ Note that using a [meta tag](/docs/#config) is the preferred mechanism for setti
* `settlingClass:'htmx-settling'` - string: the class to place on target elements when htmx is in the settling phase
* `swappingClass:'htmx-swapping'` - string: the class to place on target elements when htmx is in the swapping phase
* `allowEval:true` - boolean: allows the use of eval-like functionality in htmx, to enable `hx-vars`, trigger conditions & script tag evaluation. Can be set to `false` for CSP compatibility
* `withCredentials:false` - boolean: allow cross-site Access-Control requests using credentials such as cookies, authorization headers or TLS client certificates
* `wsReconnectDelay:full-jitter` - string/function: the default implementation of `getWebSocketReconnectDelay` for reconnecting after unexpected connection loss by the event code `Abnormal Closure`, `Service Restart` or `Try Again Later`
##### Example

View File

@ -61,17 +61,17 @@ This anchor tag tells a browser:
With that in mind, consider the following bit of HTML:
``` html
<div hx-post="/clicked"
<button hx-post="/clicked"
hx-trigger="click"
hx-target="#parent-div"
hx-swap="outerHTML">
Click Me!
</div>
</button>
```
This tells htmx:
> "When a user clicks on this div, issue an HTTP POST request to '/clicked' and use the content from the response
> "When a user clicks on this button, issue an HTTP POST request to '/clicked' and use the content from the response
> to replace the element with the id `parent-div` in the DOM"
Htmx extends and generalizes the core idea of HTML as a hypertext, opening up many more possibilities directly