Docs

Everything You Need to Know

DOM

104 vs 247

Intro

Truck Chassis

Truck has its own DOM selector engine which provides identical functionality to jQuery. Truck's DOM engine is only 104KB compared to jQuery 1.3.2 being 247KB. The main reason we can do this is because we are targetting modern browsers.

  • $(selector) - find selector
  • $(function) - run a DOM ready
  • $(markup) - create elements from markup
  • element.find(selector) - find descendant
  • element.is(selector)
  • element.not(selector)
  • element.has(selector)
  • element.prev(selector?)
  • element.prevAll(selector?)
  • element.next(selector?)
  • element.nextAll(selector?)
  • element.first()
  • element.last()
  • element.index(element?)
  • element.children(selector?)
  • element.siblings(selector?)
  • element.parent()
  • element.closest(selector)
  • element.css(property)
  • element.css(property, value)
  • element.width()
  • element.height()
  • element.before(content)
  • element.after(content)
  • element.prepend(content)
  • element.append(content)
  • element.prependTo(selector)
  • element.appendTo(selector)
  • element.clone(true?)
  • element.wrap(markup)
  • element.unwrap()
  • element.offset()
  • element.position()
  • element.empty()
  • element.html(content)
  • element.html()
  • element.text(content)
  • element.text()
  • element.remove()
  • element.replaceWith()
  • element.addClass(className)
  • element.hasClass(className)
  • element.removeClass(className)
  • element.toggleClass(className)
  • element.attr(property)
  • element.attr(property, value)
  • element.removeAttr(property)
  • element.prop(property)
  • element.prop(property, value)
  • element.removeProp(property)
  • element.disable().
  • element.enable()
  • element.val(value)
  • element.val()
  • element.hide()
  • element.show()
  • element.data(key, value)
  • element.data(key)
  • element.removeData(key)
  • element.on(event, callback, type)
  • element.on(event, element, callback, type)
  • element.off(event, callback, type)
  • element.off(event, element, callback, type)
  • element.trigger(event)
  • element.serializeArray()
  • element.serialize()
  • element.eq(index)
  • element.push(element)
  • element.pop()
  • element.unshift(element)
  • element.shift()
  • element.each(callback)
  • element.slice()
  • element.splice()
  • element.filter(callback)
  • element.map(callback)
  • element.every(callback)
  • element.some(callback)
  • element.unique()
  • $.param(obj, traditional)
  • $.type(object).
  • $.each(object, callback)
  • $.noop
  • $.delay(func, milliseconds)
  • $.defer(func)
  • $.require(scriptSrc, callback