正确的功能顺序

时间:2017-11-26 07:30:51

标签: javascript

这些顺序应该是什么?

https://jsfiddle.net/v8uoy1xw/2/

功能upTo

功能秀(el)

function hide(el)

还是这个?

功能秀(el)

function hide(el)

功能upTo

   function upTo(el, selector) {
     while (el.matches(selector) === false) {
       el = el.parentNode;
     }
     return el;
   }

   function show(el) {
     el.classList.remove("hide");
   }

   function hide(el) {
     el.classList.add("hide");
   }

0 个答案:

没有答案