Skip to content

Lighter syntax for create()? #94

@aawwawa

Description

@aawwawa

Discussed this with @rvagg in IRC briefly. Here's the alias I would propose:

bonzo.new = function(tagname) { 
    return bonzo.create('<'+ tagname +'>');
};

It could obviously be implemented more performantly as a direct interface to the DOM, but I think it would be a more intuitive API. The current name create() evokes the native DOM's document.create(), which accepts a tag name, not a tag. So intuitively I always want to write bonzo.create('div'), and not bonzo.create('<div>'). That was perhaps the most recurring hitch in my adjustment to the API, FWIW.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions