Skip to content

感觉 selector 绑定 function 的 this 指向不合理 #21

@webMagicX

Description

@webMagicX

<div id="selector"><h3>标题</h3><p>描述</p></div>

touch.bind("#selector", "tap", function(){
//点击标题
console.log(this); // this -> <h3>标题</h3>
});
这个结果明显不是想要的

var e = d.call(a.target, a);

还有一个小小的问题,手册说:
touch.trigger(element, type)
element element或string 元素对象或选择器

并不能接收 string,只能接收 element

try {
"undefined" != typeof CustomEvent ? (d = new CustomEvent(b, e), a && a.dispatchEvent(d)) : (d = document.createEvent("CustomEvent"), d.initCustomEvent(b, !0, !0, c), a && a.dispatchEvent(d))
} catch(f) {
console.warn("Touch.js is not supported by environment.")
}
明显没有处理

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions