Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix incompatibility to v1. $.ready(function() {}) used to work. #259

Open
wants to merge 3 commits into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/dom/set.js
Expand Up @@ -8,6 +8,11 @@ function set (subject, property, value) {
if (property in setProps) {
setProps[property](subject, value);
}
else if (property === "dataset") {
for (const key of Object.keys(value)) {
subject.dataset[key]=value[key]
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Please follow the code style of the rest of the codebase (smart tabs for indentation, space around operators, etc.). I need to add an ESLint file…

else if (property in subject) {
subject[property] = value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/events/delegate.js
Expand Up @@ -3,7 +3,7 @@ import bind from "./bind.js";

function delegate (subject, type, selector, callback) {
bind(subject, type, function(evt) {
if (evt.target.closest(selector)) {
if ((evt.target.closest ? evt.target : evt.target.parentNode).closest(selector)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change for? Any Element instance has closest, so I’m not sure what EventTarget instances there are that don’t have closest but their parents do. Even if such a node exists, this should be documented with comments because it's totally non-obvious.

callback.call(subject, evt);
}
});
Expand Down
3 changes: 2 additions & 1 deletion src/ready.js
@@ -1,7 +1,8 @@
export default function ready (doc = document, callback, _isVoid) {
export default function ready (doc, callback, _isVoid) {
if (typeof doc === "function" && !callback) {
[callback, doc] = [doc];
}
doc = doc || document;

if (callback) {
if (doc.readyState !== "loading") {
Expand Down