mirror of https://github.com/zulip/zulip.git
zjquery: Add attr() method.
This commit is contained in:
parent
f91dc2fec9
commit
e0d79acac0
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue