Merge branch 'master' into intigrate-collect-assets
This commit is contained in:
1 parent
ffb5de91d1
commit
f976e08f71
379 files changed
+1962
-13517
No files matched your search
@@ -390,7 +390,11 @@ class Interpreter {
|
||||
function handler(event, name, bubbles, config) {
|
||||
let target = event.target;
|
||||
if (target != null) {
|
||||
let preventDefaultRequests = target.getAttribute(`dioxus-prevent-default`);
|
||||
let preventDefaultRequests = null;
|
||||
// Some events can be triggered on text nodes, which don't have attributes
|
||||
if (target instanceof Element) {
|
||||
preventDefaultRequests = target.getAttribute(`dioxus-prevent-default`);
|
||||
}
|
||||
|
||||
if (event.type === "click") {
|
||||
// todo call prevent default if it's the right type of event
|
||||
@@ -446,15 +450,24 @@ function handler(event, name, bubbles, config) {
|
||||
target.tagName === "FORM" &&
|
||||
(event.type === "submit" || event.type === "input")
|
||||
) {
|
||||
if (
|
||||
target.tagName === "FORM" &&
|
||||
(event.type === "submit" || event.type === "input")
|
||||
) {
|
||||
const formData = new FormData(target);
|
||||
const formData = new FormData(target);
|
||||
|
||||
for (let name of formData.keys()) {
|
||||
let value = formData.getAll(name);
|
||||
contents.values[name] = value;
|
||||
for (let name of formData.keys()) {
|
||||
let value = formData.getAll(name);
|
||||
contents.values[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
target.tagName === "SELECT" &&
|
||||
event.type === "input"
|
||||
) {
|
||||
const selectData = target.options;
|
||||
contents.values["options"] = [];
|
||||
for (let i = 0; i < selectData.length; i++) {
|
||||
let option = selectData[i];
|
||||
if (option.selected) {
|
||||
contents.values["options"].push(option.value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -474,7 +487,10 @@ function handler(event, name, bubbles, config) {
|
||||
}
|
||||
|
||||
function find_real_id(target) {
|
||||
let realId = target.getAttribute(`data-dioxus-id`);
|
||||
let realId = null;
|
||||
if (target instanceof Element) {
|
||||
realId = target.getAttribute(`data-dioxus-id`);
|
||||
}
|
||||
// walk the tree to find the real element
|
||||
while (realId == null) {
|
||||
// we've reached the root we don't want to send an event
|
||||
@@ -483,7 +499,9 @@ function find_real_id(target) {
|
||||
}
|
||||
|
||||
target = target.parentElement;
|
||||
realId = target.getAttribute(`data-dioxus-id`);
|
||||
if (target instanceof Element) {
|
||||
realId = target.getAttribute(`data-dioxus-id`);
|
||||
}
|
||||
}
|
||||
return realId;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user