mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 07:21:05 +00:00
[Bugfix] Fix references to element.id (#1563)
Fix references to element.id
This commit is contained in:
parent
91d06309dc
commit
a29403f4b7
11
src/htmx.js
11
src/htmx.js
@ -760,7 +760,7 @@ return (function () {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function oobSwap(oobValue, oobElement, settleInfo) {
|
function oobSwap(oobValue, oobElement, settleInfo) {
|
||||||
var selector = "#" + oobElement.id;
|
var selector = "#" + getRawAttribute(oobElement, "id");
|
||||||
var swapStyle = "outerHTML";
|
var swapStyle = "outerHTML";
|
||||||
if (oobValue === "true") {
|
if (oobValue === "true") {
|
||||||
// do nothing
|
// do nothing
|
||||||
@ -841,8 +841,9 @@ return (function () {
|
|||||||
|
|
||||||
function handleAttributes(parentNode, fragment, settleInfo) {
|
function handleAttributes(parentNode, fragment, settleInfo) {
|
||||||
forEach(fragment.querySelectorAll("[id]"), function (newNode) {
|
forEach(fragment.querySelectorAll("[id]"), function (newNode) {
|
||||||
if (newNode.id && newNode.id.length > 0) {
|
var id = getRawAttribute(newNode, "id")
|
||||||
var normalizedId = newNode.id.replace("'", "\\'");
|
if (id && id.length > 0) {
|
||||||
|
var normalizedId = id.replace("'", "\\'");
|
||||||
var normalizedTag = newNode.tagName.replace(':', '\\:');
|
var normalizedTag = newNode.tagName.replace(':', '\\:');
|
||||||
var oldNode = parentNode.querySelector(normalizedTag + "[id='" + normalizedId + "']");
|
var oldNode = parentNode.querySelector(normalizedTag + "[id='" + normalizedId + "']");
|
||||||
if (oldNode && oldNode !== parentNode) {
|
if (oldNode && oldNode !== parentNode) {
|
||||||
@ -3354,8 +3355,8 @@ return (function () {
|
|||||||
|
|
||||||
if (selectionInfo.elt &&
|
if (selectionInfo.elt &&
|
||||||
!bodyContains(selectionInfo.elt) &&
|
!bodyContains(selectionInfo.elt) &&
|
||||||
selectionInfo.elt.id) {
|
getRawAttribute(selectionInfo.elt, "id")) {
|
||||||
var newActiveElt = document.getElementById(selectionInfo.elt.id);
|
var newActiveElt = document.getElementById(getRawAttribute(selectionInfo.elt, "id"));
|
||||||
var focusOptions = { preventScroll: swapSpec.focusScroll !== undefined ? !swapSpec.focusScroll : !htmx.config.defaultFocusScroll };
|
var focusOptions = { preventScroll: swapSpec.focusScroll !== undefined ? !swapSpec.focusScroll : !htmx.config.defaultFocusScroll };
|
||||||
if (newActiveElt) {
|
if (newActiveElt) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
Loading…
x
Reference in New Issue
Block a user