HTML builders change suggestsion

35 views
Skip to first unread message

Maxim Shafirov

unread,
Feb 1, 2013, 11:04:52 AM2/1/13
to karafr...@googlegroups.com
Tag building functions currently receive all possible properties as parameters with empty default.
Don't you think we'd better left only those attrs, that end user will need for sure, like href in A and allow all the others to be set inside tag's body?
I see two drawbacks in current implementation:
- Defaults passing is implemented quite effectively in Kotlin but it isn't free. You may want to refer to bytecode in Kotlin toolwindow
- Function signature normally serves as documentation for the programmer about what makes sense to pass there, while current state is more about "what's legal to pass there".

What do you think?

Andy Selvig

unread,
Feb 1, 2013, 1:50:12 PM2/1/13
to karafr...@googlegroups.com
Seems reasonable. How do we determine which attributes are "required" for each tag? I guess I could just use my list of non-common attributes that I defined in order to build the builder classes (in addition to class and id, which I think should be in every function). This currently consists of:

a: href rel target
canvas: width height
form: action enctype method
img: width height src alt
input: accept alt autocomplete autofocus checked disabled height list max maxlength min multiple inputType name pattern placeholder readonly required size src step value width
label: forId
select: name size multiple disabled
option: label value selected disabled
option: label disabled
textarea: autofocus cols disabled maxlength name placeholder readonly required rows wrap

But I can easily add more. Does this seems like a better approach than including everything? Maybe we could narrow it down even further by only including inputType and value for input, since that list is pretty long just by itself.

Maxim Shafirov

unread,
Feb 1, 2013, 2:36:20 PM2/1/13
to Andy Selvig, karafr...@googlegroups.com
I have weird idea to scan some representative amount of real world sites and build statistics  

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "Kara Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karaframewor...@googlegroups.com.
To post to this group, send email to karafr...@googlegroups.com.
Visit this group at http://groups.google.com/group/karaframework?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Andy Selvig

unread,
Feb 1, 2013, 3:05:41 PM2/1/13
to Maxim Shafirov, karafr...@googlegroups.com

That IS a weird idea, but don't let me stop you :)

Andrey Cheptsov

unread,
Feb 1, 2013, 3:22:25 PM2/1/13
to Maxim Shafirov, Andy Selvig, karafr...@googlegroups.com
BTW.

About the current implementation of routes and controllers.

Now we have the folder called "routes". However this folder contains controllers logic as well. It seems not well-consistent.

Any ideas?

01.02.2013, в 23:36, Maxim Shafirov <maxim.s...@gmail.com> написал(а):

Andrey Cheptsov

unread,
Feb 1, 2013, 3:24:15 PM2/1/13
to Maxim Shafirov, Andy Selvig, karafr...@googlegroups.com
I would also suggest you consider HTML5 and CSS3 (mobile as well) in the first place.

01.02.2013, в 23:36, Maxim Shafirov <maxim.s...@gmail.com> написал(а):

Maxim Shafirov

unread,
Feb 1, 2013, 3:34:34 PM2/1/13
to Andrey Cheptsov, Andy Selvig, karafr...@googlegroups.com
None, other than renaming stuff back to controllers

Sent from my iPhone

Andy Selvig

unread,
Feb 1, 2013, 4:11:07 PM2/1/13
to Maxim Shafirov, Andrey Cheptsov, karafr...@googlegroups.com
I would also suggest you consider HTML5 and CSS3 (mobile as well) in the first place.
I'm not sure what you're referring to here.

Now we have the folder called "routes". However this folder contains controllers logic as well. It seems not well-consistent.
Basically we have these objects that define both the routing and actions. This has become very popular with frameworks like Sinatra and Flask, and I like the simplicity of it. Whether or not we call these objects Routes or Controllers seems arbitrary to me. Maybe there's a better name we haven't thought of?

Maxim Shafirov

unread,
Feb 4, 2013, 3:59:22 AM2/4/13
to Andy Selvig, karafr...@googlegroups.com
Here's stats for scanning 1000 mostly random hosts:

A occured 142020 times
    98.31% (139623) href
    39.41% (55972) class
    15.21% (21595) title
    9.99% (14188) target
    7.66% (10879) style
    5.62% (7982) rel
    4.25% (6041) mapleultparams
    4.17% (5929) id
    3.04% (4313) onclick
    1.52% (2159) name

DIV occured 120561 times
    86.60% (104400) class
    16.51% (19907) id
    7.02% (8460) style
    1.76% (2117) onclick

LI occured 71925 times
    45.57% (32778) class
    9.82% (7060) id
    1.58% (1138) onclick
    1.50% (1078) style

SPAN occured 58360 times
    66.86% (39022) class
    4.86% (2837) id
    3.87% (2260) style
    3.16% (1842) title
    2.74% (1597) itemprop
    2.32% (1353) lang
    2.00% (1168) onclick

TD occured 30968 times
    56.67% (17550) class
    9.19% (2846) width
    8.67% (2684) style
    7.68% (2377) valign
    7.57% (2345) align
    4.36% (1349) colspan
    2.13% (659) nowrap
    1.93% (598) id
    1.60% (494) height
    1.46% (451) onclick
    1.45% (448) bgcolor
    1.31% (405) rowspan

IMG occured 26854 times
    99.01% (26587) src
    73.43% (19719) alt
    52.67% (14145) width
    49.56% (13310) height
    33.76% (9066) class
    19.02% (5107) border
    16.95% (4553) title
    12.80% (3437) style
    3.20% (859) align
    2.42% (650) hspace
    2.23% (599) vspace
    2.04% (548) id
    1.32% (354) href
    1.05% (282) data-thumb

SCRIPT occured 20794 times
    99.08% (20603) type
    34.94% (7265) src
    14.48% (3012) language
    4.30% (895) charset
    1.39% (289) id

P occured 18963 times
    39.73% (7534) class
    5.83% (1105) style
    1.89% (358) id

UL occured 13586 times
    57.87% (7862) class
    10.36% (1407) id
    4.19% (569) style
    1.00% (136) role

BR occured 13470 times
    2.26% (304) class
    1.18% (159) clear

OPTION occured 12611 times
    96.14% (12124) value
    2.05% (258) label
    1.96% (247) selected
    1.13% (143) lang
    1.09% (138) url

TR occured 11295 times
    11.96% (1351) class
    3.06% (346) valign
    1.66% (188) id
    1.24% (140) align
    1.00% (113) style

META occured 8580 times
    97.44% (8360) content
    55.84% (4791) name
    19.15% (1643) property
    15.35% (1317) http-equiv
    7.86% (674) itemprop
    1.68% (144) charset

INPUT occured 8575 times
    96.47% (8272) type
    81.20% (6963) name
    80.98% (6944) value
    47.30% (4056) id
    37.49% (3215) class
    6.39% (548) maxlength
    6.15% (527) tabindex
    5.89% (505) title
    5.14% (441) autocomplete
    4.27% (366) onclick
    4.14% (355) size
    3.67% (315) style
    3.15% (270) checked
    3.00% (257) placeholder
    2.31% (198) src
    2.27% (195) onfocus
    1.62% (139) onblur
    1.54% (132) hidefocus
    1.53% (131) alt

H2 occured 5970 times
    44.74% (2671) class
    1.51% (90) style
    1.36% (81) id

B occured 5623 times
    9.07% (510) class
    1.32% (74) style

LINK occured 5538 times
    99.17% (5492) href
    98.63% (5462) rel
    73.09% (4048) type
    14.93% (827) title
    13.36% (740) media
    7.66% (424) hreflang
    1.37% (76) id
    1.05% (58) sizes

TABLE occured 5122 times
    51.78% (2652) class
    48.18% (2468) cellspacing
    45.14% (2312) cellpadding
    29.68% (1520) border
    25.65% (1314) width
    10.11% (518) style
    7.58% (388) id
    3.85% (197) height
    3.73% (191) onclick
    2.69% (138) summary
    2.64% (135) align
    2.36% (121) bgcolor
    1.21% (62) role

H3 occured 4657 times
    34.06% (1586) class
    3.69% (172) style
    3.16% (147) id

STRONG occured 3417 times
    11.35% (388) class

LABEL occured 2709 times
    62.35% (1689) for
    52.05% (1410) class
    3.91% (106) onclick
    3.77% (102) id
    2.25% (61) style
    1.55% (42) title

H4 occured 2539 times
    33.08% (840) class
    2.91% (74) id
    1.42% (36) data-query
    1.42% (36) data-linid
    1.42% (36) data-vcrrss

NOSCRIPT occured 2414 times
    1.74% (42) class
    1.70% (41) onclick

EM occured 2292 times
    13.53% (310) class
    1.75% (40) title

DD occured 2014 times
    31.68% (638) class

FORM occured 1797 times
    90.60% (1628) action
    72.57% (1304) method
    40.79% (733) id
    35.89% (645) class
    28.60% (514) name
    10.41% (187) onsubmit
    7.90% (142) target
    5.95% (107) onclick
    5.84% (105) style
    3.90% (70) role
    2.84% (51) accept-charset
    1.39% (25) novalidate
    1.28% (23) enctype
    1.11% (20) data-forum_id
    1.11% (20) data-suggestion_id

BUTTON occured 1591 times
    92.58% (1473) class
    62.29% (991) type
    35.58% (566) onclick
    26.65% (424) role
    26.52% (422) id
    19.99% (318) title
    11.00% (175) data-button-menu-id
    9.37% (149) data-video-ids
    9.11% (145) name
    8.36% (133) value
    6.60% (105) data-action
    5.59% (89) href
    4.40% (70) data-tooltip-show-delay
    3.52% (56) data-url
    3.21% (51) disabled
    3.14% (50) data-button-toggle
    2.77% (44) data-b
    2.51% (40) tabindex
    2.39% (38) data-button-action
    2.33% (37) data-button-has-sibling-menu
    2.20% (35) aria-haspopup
    2.20% (35) aria-pressed
    2.20% (35) aria-activedescendant
    2.20% (35) aria-expanded
    1.57% (25) style
    1.51% (24) data-picker-key
    1.51% (24) data-picker-position
    1.26% (20) data-plural
    1.26% (20) data-singular
    1.13% (18) data-close-parent-class
    1.01% (16) data-trigger-for

NOBR occured 1445 times

DT occured 1422 times
    22.57% (321) class

I occured 1376 times
    53.20% (732) class
    6.40% (88) id

H5 occured 1316 times
    24.47% (322) class
    15.73% (207) id
    14.13% (186) data-linid
    14.13% (186) data-vcrrss
    13.22% (174) data-query
    1.37% (18) title

DL occured 1131 times
    54.38% (615) class
    3.98% (45) id
    3.18% (36) style

STYLE occured 1116 times
    100.00% (1116) type
    2.24% (25) id
    2.15% (24) media

TH occured 1072 times
    41.32% (443) class
    11.10% (119) scope
    8.30% (89) width
    6.25% (67) colspan
    5.04% (54) rowspan
    2.99% (32) id
    2.89% (31) align
    2.52% (27) style
    2.24% (24) title

TITLE occured 1022 times

HEAD occured 976 times
    3.79% (37) prefix
    1.95% (19) id

HTML occured 976 times
    41.60% (406) lang
    38.11% (372) xmlns
    23.67% (231) xml:lang
    17.62% (172) xmlns:fb
    15.47% (151) class
    13.73% (134) xmlns:og
    5.94% (58) dir
    2.87% (28) id
    2.25% (22) itemscope
    2.25% (22) itemtype

BODY occured 975 times
    40.00% (390) class
    13.54% (132) id
    8.31% (81) dir
    5.23% (51) onload
    5.03% (49) bgcolor
    2.67% (26) marginheight
    2.67% (26) marginwidth
    2.46% (24) style
    2.46% (24) onclick
    2.05% (20) leftmargin
    2.05% (20) topmargin
    1.33% (13) text

SMALL occured 926 times
    24.84% (230) class

H1 occured 922 times
    35.25% (325) class
    6.51% (60) style
    4.56% (42) id
    1.19% (11) lang

TBODY occured 791 times
    5.44% (43) role
    2.02% (16) title
    1.90% (15) class

CITE occured 745 times
    6.58% (49) class

IFRAME occured 716 times
    91.20% (653) frameborder
    89.80% (643) src
    75.70% (542) scrolling
    56.56% (405) height
    56.15% (402) width
    50.28% (360) style
    31.84% (228) marginheight
    31.70% (227) marginwidth
    24.30% (174) id
    23.88% (171) allowtransparency
    13.41% (96) class
    8.80% (63) name
    7.82% (56) hspace
    7.82% (56) vspace
    4.33% (31) type
    4.33% (31) title
    2.51% (18) count
    2.51% (18) seamless
    2.37% (17) allowfullscreen
    2.23% (16) tabindex
    1.68% (12) border
    1.12% (8) bordercolor
    1.12% (8) onload

FONT occured 699 times
    48.21% (337) color
    30.76% (215) size
    18.88% (132) class
    15.59% (109) style
    3.15% (22) face

SELECT occured 617 times
    69.85% (431) name
    56.73% (350) id
    53.48% (330) class
    17.67% (109) style
    16.37% (101) onchange
    4.70% (29) tabindex
    4.70% (29) size
    4.21% (26) disabled
    1.94% (12) autocomplete
    1.94% (12) aria-required
    1.78% (11) title

FIELDSET occured 418 times
    52.15% (218) class
    8.13% (34) id
    5.26% (22) aria-relevant
    5.26% (22) data-options
    5.26% (22) aria-live
    4.07% (17) style

CENTER occured 407 times
    1.47% (6) style

OL occured 362 times
    72.10% (261) class
    14.92% (54) style
    10.22% (37) start
    9.39% (34) id

PARAM occured 361 times
    99.72% (360) name
    98.89% (357) value

HR occured 358 times
    22.07% (79) class
    7.82% (28) size
    3.35% (12) color
    2.51% (9) noshade
    2.23% (8) style
    1.68% (6) width
    1.12% (4) align

TEXTAREA occured 307 times
    68.08% (209) id
    52.12% (160) name
    38.44% (118) rows
    34.53% (106) class
    28.66% (88) cols
    26.71% (82) style
    8.14% (25) maxlength
    5.54% (17) onfocus
    4.23% (13) onblur
    4.23% (13) placeholder
    3.91% (12) onkeyup
    3.58% (11) tabindex
    2.61% (8) readonly
    2.28% (7) onchange
    1.63% (5) type
    1.63% (5) wrap
    1.30% (4) onclick

ABBR occured 297 times
    96.63% (287) title
    33.67% (100) class

U occured 265 times
    5.28% (14) class
    3.02% (8) onclick
    2.64% (7) style
    1.89% (5) title

SUP occured 227 times
    12.78% (29) class
    4.41% (10) style
    2.64% (6) id

CODE occured 209 times
    73.68% (154) class

S occured 196 times
    1.53% (3) class

COL occured 187 times
    50.27% (94) class
    43.85% (82) width
    2.14% (4) style

LEGEND occured 173 times
    36.99% (64) class
    5.20% (9) id
    1.73% (3) title

SPACER occured 161 times
    98.14% (158) type
    69.57% (112) height
    68.32% (110) width
    1.24% (2) border

H6 occured 161 times
    46.58% (75) class

AREA occured 107 times
    100.00% (107) shape
    100.00% (107) coords
    68.22% (73) id
    38.32% (41) href
    15.89% (17) alt
    7.48% (8) target
    5.61% (6) onmousemove
    5.61% (6) onmouseout
    5.61% (6) onfocus
    5.61% (6) onmouseover
    5.61% (6) onclick
    3.74% (4) class

ADDRESS occured 88 times
    17.05% (15) class
    4.55% (4) id

THEAD occured 73 times
    5.48% (4) class
    2.74% (2) id

BASE occured 61 times
    83.61% (51) href
    16.39% (10) id

PRE occured 60 times
    90.00% (54) class
    28.33% (17) id
    28.33% (17) style
    1.67% (1) itemprop

OBJECT occured 54 times
    90.74% (49) height
    90.74% (49) width
    61.11% (33) id
    55.56% (30) classid
    40.74% (22) codebase
    33.33% (18) data
    25.93% (14) type
    24.07% (13) align
    11.11% (6) class
    7.41% (4) title
    3.70% (2) style
    1.85% (1) name

BLOCKQUOTE occured 43 times
    48.84% (21) class
    11.63% (5) lang
    2.33% (1) cite
    2.33% (1) to

DFN occured 35 times

COLGROUP occured 30 times

EMBED occured 30 times
    100.00% (30) width
    100.00% (30) type
    100.00% (30) height
    100.00% (30) src
    90.00% (27) allowscriptaccess
    70.00% (21) pluginspage
    70.00% (21) quality
    56.67% (17) bgcolor
    56.67% (17) name
    50.00% (15) wmode
    46.67% (14) allowfullscreen
    43.33% (13) flashvars
    43.33% (13) align
    10.00% (3) id
    6.67% (2) vmode
    3.33% (1) scale
    3.33% (1) menu
    3.33% (1) swliveconnect

Q occured 28 times
    3.57% (1) t
    3.57% (1) l

TFOOT occured 26 times

VAR occured 24 times

WBR occured 22 times

ACRONYM occured 22 times
    100.00% (22) title

MAP occured 16 times
    100.00% (16) name
    37.50% (6) id
    12.50% (2) title

CAPTION occured 11 times
    72.73% (8) class

TT occured 10 times
    60.00% (6) style

BIG occured 6 times

OPTGROUP occured 5 times
    100.00% (5) label

INS occured 5 times
    60.00% (3) class
    20.00% (1) style

SUB occured 3 times
    100.00% (3) style

DEL occured 1 times

NOEMBED occured 1 times

STRIKE occured 1 times

MARQUEE occured 1 times
    100.00% (1) scrollamount
    100.00% (1) width
    100.00% (1) align
    100.00% (1) scrolldelay
    100.00% (1) border

FRAME occured 1 times
    100.00% (1) src

FRAMESET occured 1 times

Andy Selvig

unread,
Feb 5, 2013, 10:37:33 AM2/5/13
to Maxim Shafirov, karafr...@googlegroups.com
Wow, very interesting. So what do you want to do, pick some arbitrary threshold, like 10%, and include everything above? I definitely think all elements should have class and id, but other than that I'm open.
Reply all
Reply to author
Forward
0 new messages