LoginSignup
51
55

More than 5 years have passed since last update.

jQueryを標準APIに置き換える

Last updated at Posted at 2015-03-18

jQuery追放作業用の備忘録です。

NG:不明

title取得

$(el).attr('title');

el.title;

outerWidth

$(el).outerWidth();

el.offsetWidth

outerHeight

$(el).outerHeight();

el.offsetHeight

style設定

$(el).css('border-width', '20px');

el.style.borderWidth = '20px';

NG:IE8

子供をeach

$(el).chidlren().each(function(index, element){
  // do anything...
});

Array.prototype.forEach.call(el.children, function(element, index){
  // do anything...
});

next

$(el).next();

el.nextElementSibling

prev

$(el).prev();

el.previousElementSibling

NG:IE9

hasClass

$(el).hasClass(className);

el.classList.contains(className);

参考リンク

You Might Not Need jQuery

51
55
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
51
55