Giter Site home page Giter Site logo

prop: naming inconsistencies about vecty HOT 11 CLOSED

hexops avatar hexops commented on May 18, 2024
prop: naming inconsistencies

from vecty.

Comments (11)

dominikh avatar dominikh commented on May 18, 2024 1

Generally speaking, I'm 👍 for ID and Href. Yes, Href technically stands for two words. However, ID technically stands for one word, yet is treated like an acronym. We have some freedom in mangling names ;)

from vecty.

slimsag avatar slimsag commented on May 18, 2024 1

Sounds like we all agree to go with ID and Href, I've created #32 to switch to ID. PTAL.

from vecty.

dmitshur avatar dmitshur commented on May 18, 2024

How does the recent Element -> Elem and Property -> Prop change tie in here?

I might be missing contedxt, but Href, Id are much more readable to me (being familiar with HTML lingo) than HypertextReference and Identity... Unless they're supposed to represent something else?

from vecty.

slimsag avatar slimsag commented on May 18, 2024

For example, we rename the <h1> tag to become elem.Header1 here: https://github.com/gopherjs/vecty/blob/master/elem/generate.go#L34

I agree that Href and Id are more readable.. and that makes me uncertain of the naming scheme/remapping used by the elem event and style packages.

from vecty.

neelance avatar neelance commented on May 18, 2024

Rob Pike: Length is not a virtue in a name; clarity of expression is.

For example Header1 instead of H1 conveys a lot more information. But what the heck does a HypertextReference do? ;-) I think href is so common, everyone knows it.
However, it might be good to stay consistent, at least inside of each package. I opted for longer element names because the acronyms of HTML tags are really bad and some of them already have longer class names in the DOM API. Properties and styles however already have proper names in the DOM API, so I think we should keep them.

from vecty.

bep avatar bep commented on May 18, 2024

Go's vet tool will complain about Id and suggest ID, at least in vars like elementID.

from vecty.

slimsag avatar slimsag commented on May 18, 2024

@neelance thanks for clearing this up :) I think what you said makes sense, and from creating this issue that is exactly what I wanted to find out: what exactly is the name remapping pattern? I think you answered that clearly and I'm happy with it 👍

@neelance @bep maybe we should Id -> ID and Href -> HRef ?

from vecty.

bep avatar bep commented on May 18, 2024

I watch this repo with interest as this is something I need and want, so I have no strong meaning about this. But getting the names right before people start using it saves a lot of trouble in the long run. I did a major naming cleanup of the API of Hugo a couple of months ago ... A lot of work with all the themes etc ...

from vecty.

dmitshur avatar dmitshur commented on May 18, 2024

Id -> ID

Definitely. Consider honnef.co/go/js/dom a good example (/cc @dominikh). It has GetElementByID not getElementById.

About Href, I'm unsure that HRef is better. I consider "href" to be one weird word. Also see https://godoc.org/honnef.co/go/js/dom#HTMLLinkElement.Href.

from vecty.

slimsag avatar slimsag commented on May 18, 2024

About Href, I'm unsure that HRef is better. I consider "href" to be one weird word. Also see https://godoc.org/honnef.co/go/js/dom#HTMLLinkElement.Href.

FWIW I agree with your stance and think that Href reads better than HRef. But, we're being inconsistent, because href does stand for Hypertext Reference (two words), so... maybe we can blame HTML naming horror 😱

from vecty.

neelance avatar neelance commented on May 18, 2024

I also consider Href as a weird word, same as @shurcooL.

from vecty.

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.