mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
Merge pull request #145 from rros/users/rros/fix-queryselector-issue
Fix issue with unquoted id attribute in query selector
This commit is contained in:
commit
8983448b33
@ -436,7 +436,7 @@ return (function () {
|
||||
function handleAttributes(parentNode, fragment, settleInfo) {
|
||||
forEach(fragment.querySelectorAll("[id]"), function (newNode) {
|
||||
if (newNode.id && newNode.id.length > 0) {
|
||||
var oldNode = parentNode.querySelector(newNode.tagName + "[id=" + newNode.id + "]");
|
||||
var oldNode = parentNode.querySelector(newNode.tagName + "[id='" + newNode.id + "']");
|
||||
if (oldNode && oldNode !== parentNode) {
|
||||
var newAttributes = newNode.cloneNode();
|
||||
cloneAttributes(newNode, oldNode);
|
||||
|
@ -65,4 +65,12 @@ describe("Core htmx Regression Tests", function(){
|
||||
div.innerText.should.contain("Foo")
|
||||
});
|
||||
|
||||
it ('id with dot in value doesnt cause an error', function(){
|
||||
this.server.respondWith("GET", "/test", "Foo <div id='ViewModel.Test'></div>");
|
||||
var div = make('<div hx-get="/test">Get It</div>');
|
||||
div.click();
|
||||
this.server.respond();
|
||||
div.innerText.should.contain("Foo");
|
||||
});
|
||||
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user