HTMLElement

HTMLElement.dataset


<article id="article-10" data-created="2018-05-02" data-author="Alice">
  ...
</article>
const article = document.querySelector('article')
console.log(article.dataset.created) //=> 2018-05-02
console.log(article.dataset.author)  //=> Alice

References:

HTMLElement.style


CSSStyleDeclaration:

const p = document.querySelector('p')
p.style.cssText = "color: blue;"

CSSStyleDeclaration.cssText:

const p = document.querySelector('p')
p.style.cssText = "color: blue; font-size: 1.1rem;"

CSS Properties:

const p = document.querySelector('p')
p.style.fontSize = "1.1rem"

Element.setAttribute() (Alternative):

const p = document.querySelector('p')
p.setAttribute("style", "color: blue; font-size: 1.1rem;")
const p = document.querySelector('p')
p.setAttribute("class", "active red")

Element.classList (Alternative):

const p = document.querySelector('p')
p.classList.add('color-blue')

Element.className (Alternative):

const p = document.querySelector('p')
p.className = 'text-center'

CSS Typed Object Model (Alternative):

const p = document.querySelector('p')
p.attributeStyleMap.set('opacity', 0.3)
p.attributeStyleMap.get('opacity').value //=> 0.3
p.attributeStyleMap.has('opacity');      //=> true
p.attributeStyleMap.delete('opacity');
p.attributeStyleMap.clear();             // remove all styles

HTMLElement.click()


const button = document.querySelector('button')
button.click()

HTMLElement.focus()


const input = document.querySelector('#name')
input.focus()