Giter Club home page Giter Club logo

Comments (4)

aawwawa avatar aawwawa commented on June 7, 2024

Using new('div') would read better aloud, and make more intuitive sense as english. In my brief tests, having a member function of an object called new() does NOT conflict with the JS new keyword.

from bonzo.

connor avatar connor commented on June 7, 2024

im digging this. should we worry about new'ing multiple elements, at all? that might be dumb and complicating things that don't need to be. i'm all for this alias though.

from bonzo.

rvagg avatar rvagg commented on June 7, 2024

It's really just an alias for document.createElement(tagname), the overhead of bonzo.create() can be completely avoided for this case. But because it's just duplicating an existing function that's available across browsers then perhaps this is just fluff?

from bonzo.

ded avatar ded commented on June 7, 2024

We did this on Medium.com in an internal version of ender (just extending $).

$.createElement = function (tagName) {
  return $(document.createElement(tagName))
}

there were cases in the Editor where i'd need to create an Ender element out of a tag name. and it was more of a hassle to do this...

$('<' + tagName + '/>')

from bonzo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.