block by 1wheel ae4d68a4b72d08c25c47f27cc5815672

camelCase attributes

Full Screen

at and st in jetpack work like v3’s attr and style. Passing an object sets multiple attributes, passing a string returns a single attribute and passing a string & second argument sets a single attribute.

To avoid having to use quotes around attributes and styles with hyphens when using the object notation, camelCase keys are hyphenated. Instead of:

selection
    .style('margin-top', '250px')
    .style('text-align', 'center')
    .style('font-weight', 600)

or with d3-selection-multi:

selection.styles({'margin-top': '250px', 'text-align': 'center', 'font-weight': 600})

you can write:

selection.st({fontSize: '250px', textAlign: 'center', fontWeight: 600})

With syntax highlighting on, it is a little easier to see the difference between keys and values when everything isn’t a string. Plus there’s less typing!

index.html