zjquery: Add attr() method.

This commit is contained in:
Steve Howell 2017-06-16 14:55:07 -04:00
parent f91dc2fec9
commit e0d79acac0
1 changed files with 10 additions and 1 deletions

View File

@ -15,6 +15,7 @@ exports.make_zjquery = function () {
var children = new Dict();
var my_parent;
var properties = new Dict();
var attrs = new Dict();
var classes = new Dict();
var on_functions = new Dict();
@ -29,7 +30,9 @@ exports.make_zjquery = function () {
data: noop,
empty: noop,
height: noop,
removeAttr: noop,
removeAttr: function (name) {
attrs.del(name);
},
removeData: noop,
trigger: function (ev) {
var funcs = on_functions.get(ev.name) || [];
@ -129,6 +132,12 @@ exports.make_zjquery = function () {
assert.equal(idx, 0);
return selector;
},
attr: function (name, val) {
if (val === undefined) {
return attrs.get(name);
}
attrs.set(name, val);
},
prop: function (name, val) {
if (val === undefined) {
return properties.get(name);