Is there a naming convention for custom Polymer elements?

25 views
Skip to first unread message

Demetrios Papadopoulos

unread,
Apr 27, 2016, 7:30:02 PM4/27/16
to Chromium Settings
Hi Settings devs,

There are 94 custom Polymer elements defined under chrome/browser/resources/settings
(see attachment). 72 of them have the prefix "settings-", 22 do not.

1) Is there a naming convention? Do we need one?
2) Should we be using the prefix for newly added elements?

Personally I have been using the prefix for all elements I have added, because
I thought it was a convention by looking at surrounding code. Specifically the pattern I have been
following is

Element name: <setting-my-foo-element>
file name: my_foo_element.html, my_foo_element.js (omitting the prefix in the file name).

Asking because it came up in a review.

Thank you,
Demetrios
elements.txt

Rachel Blum

unread,
Apr 27, 2016, 7:34:09 PM4/27/16
to Demetrios Papadopoulos, Chromium Settings
+1 to naming convention. Just because the majority of code already does. 

--
You received this message because you are subscribed to the Google Groups "Chromium Settings" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-setti...@chromium.org.
To post to this group, send email to chromium...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-settings/14876867-b1f3-4346-a784-d8de21e317f9%40chromium.org.

Michael Giuffrida

unread,
Apr 27, 2016, 7:36:25 PM4/27/16
to Rachel Blum, Demetrios Papadopoulos, Chromium Settings
The naming convention you described is the one we have been using. I think we should just stay on course.

Some exceptions (bluetooth, networking) are because we intend to use those elements outside md-settings.

Dan Beam

unread,
Apr 27, 2016, 7:57:13 PM4/27/16
to Michael Giuffrida, Rachel Blum, Demetrios Papadopoulos, Chromium Settings
On Wed, Apr 27, 2016 at 4:36 PM, Michael Giuffrida <mich...@chromium.org> wrote:
The naming convention you described is the one we have been using. I think we should just stay on course.

Some exceptions (bluetooth, networking) are because we intend to use those elements outside md-settings.

^ Didn't know this, but it makes sense.

+1 to <settings-*>, then.  I'd prefer shorter; you really only need 2 dash-separated words for a valid custom element name BUT I don't really care and we're in a pretty consistent spot already.

It mildly irks me that a file named some_section.js actually defines a class named SettingsSomeSection (i.e. missing a "settings_" from file name), but meh.

-- Dan
 

Demetrios Papadopoulos

unread,
Apr 27, 2016, 9:04:38 PM4/27/16
to Chromium Settings, mich...@chromium.org, gr...@chromium.org, dpa...@chromium.org
Thanks all for the quick responses. I am wondering whether the Polymer WebUI style guide here is the right place to record this naming convention (even though that doc is not MD settings specific).
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-settings+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "Chromium Settings" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-settings+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "Chromium Settings" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-settings+unsubscribe@chromium.org.

To post to this group, send email to chromium...@chromium.org.
Reply all
Reply to author
Forward
0 new messages