kupriyanenko / jbone

JavaScript Library for Events and DOM manipulation. Replaces jQuery for Backbone (2.5kb gzipped)
http://jbone.js.org
MIT License
279 stars 35 forks source link

Allow to pass integers as well as strings #3

Closed miraage closed 10 years ago

miraage commented 10 years ago

You are checking value to being passed as string, but I think integer could be passed too. For example, method val(). https://github.com/kupriyanenko/jbone/blob/master/src/attributes.js#L22

kupriyanenko commented 10 years ago

Thanks, You are right, fixed on this commit https://github.com/kupriyanenko/jbone/commit/d17ed482e177fddf9f795c3e5643d7be11f93481

miraage commented 10 years ago

Also this strong type check can be replaced in other places. Just need to walk over code and look where replacement may be performed.

// upd.

I think the better idea is to check arguments.length, like

if (!arguments.length) { // or maybe 1 for methods like $.css('borderTop')
  // getter
} else {
  // setter
}
kupriyanenko commented 10 years ago

yes, I think in this case you are right.