You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
493 B
18 lines
493 B
var $attr = require('./$attr'); |
|
var isStr = require('./isStr'); |
|
var isObj = require('./isObj'); |
|
var each = require('./each'); |
|
var $safeEls = require('./$safeEls'); |
|
exports = function(nodes, name, val) { |
|
var dataName = name; |
|
if (isStr(name)) dataName = 'data-' + name; |
|
if (isObj(name)) { |
|
dataName = {}; |
|
each(name, function(val, key) { |
|
dataName['data-' + key] = val; |
|
}); |
|
} |
|
return $attr(nodes, dataName, val); |
|
}; |
|
|
|
module.exports = exports;
|
|
|