-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.html
684 lines (606 loc) · 26.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Selector Generators Benchmark</title>
<style>
body {font-family: sans-serif; font-size: 14px; color: #333; padding: 3em; line-height: 175%;}
table {border-collapse: collapse;}
th, td {text-align: left; padding: 0.25em 0.5em; border: 1px solid #ccc;}
</style>
<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="vendor/requirejs/require.js"></script>
<script>
require.config({
paths: {
'selector-generator': 'vendor/selector-generator/lib/selector-generator',
'CSSelector': 'vendor/CSSelector.js/dist/CSSelector',
'OptimalSelect': 'node_modules/optimal-select/dist/optimal-select',
'css-selector-generator': 'node_modules/css-selector-generator/build/css-selector-generator'
}
});
</script>
<script src="test.js"></script>
<!-- https://github.com/fczbkk/css-selector-generator -->
<script>
(function() {
require(['css-selector-generator'], function (CssSelectorGenerator) {
addLibrary('fczbkk/css-selector-generator', function (element) {
var generator = new CssSelectorGenerator;
return generator.getSelector(element)
});
});
})();
</script>
<!-- https://github.com/martinsbalodis/css-selector -->
<script src="node_modules/css-selector/lib/CssSelector.js"></script>
<script>
(function() {
window.addEventListener('load', function () {
// Lib has to be initialized after page is loaded, otherwise it throws errors.
lib = new CssSelector({
parent: document.body
});
// TODO I can't get this to work. I'll try to ask author for help.
addLibrary('martinsbalodis/css-selector', function (element) {
lib.getCssSelector([element]);
});
});
})();
</script>
<!-- https://github.com/tildeio/selector-generator -->
<script>
(function() {
require(['selector-generator'], function(sg) {
addLibrary('tildeio/selector-generator', function (element) {
return sg.generate(element).selector;
});
});
})();
</script>
<!-- https://github.com/jhartikainen/dompath -->
<script src="vendor/dompath/src/dompath.js"></script>
<script>
(function() {
addLibrary('jhartikainen/dompath', function (element) {
return dompath(element).toCSS();
});
})();
</script>
<!-- https://github.com/olivierrr/selector-query -->
<script>var module = {};</script>
<script src="node_modules/selector-query/index.js"></script>
<script>
(function() {
var selectorQuery = module.exports;
addLibrary('olivierrr/selector-query', selectorQuery);
})();
</script>
<!-- https://github.com/rishihahs/domtalk -->
<script>var module = {};</script>
<script src="node_modules/domtalk/index.js"></script>
<script>
(function() {
var domtalk = module.exports;
addLibrary('rishihahs/domtalk', domtalk.getSelectorFromElement.bind(domtalk));
})();
</script>
<!-- https://github.com/thomaspeklak/get-query-selector -->
<script>var module = {};</script>
<script src="node_modules/get-query-selector/index.js"></script>
<script>
(function() {
var getQuerySelector = module.exports;
addLibrary('thomaspeklak/get-query-selector', getQuerySelector);
})();
</script>
<!-- https://github.com/stevoland/CSSelector.js -->
<script>
(function() {
require(['CSSelector'], function(CSSelector) {
addLibrary('stevoland/CSSelector.js', CSSelector);
});
})();
</script>
<!-- https://github.com/ngs/jquery-selectorator -->
<script src="node_modules/jquery-selectorator/dist/selectorator.js"></script>
<script>
(function() {
addLibrary('ngs/jquery-selectorator', function (element) {
return $(element).getSelector();
});
})();
</script>
<!-- https://github.com/bimech/ellocate.js -->
<script src="vendor/ellocate.js/jquery.ellocate.js"></script>
<script>
(function() {
addLibrary('bimech/ellocate.js', function (element) {
return $(element).ellocate().css;
});
})();
</script>
<!-- https://github.com/desmondw/snowflake -->
<script src="vendor/snowflake/index.js"></script>
<script>
(function() {
addLibrary('desmondw/snowflake', generateSelector);
})();
</script>
<!--
https://chromium.googlesource.com/chromium/blink/+/master/Source/devtools/front_end/components/DOMPresentationUtils.js
https://gist.github.com/asfaltboy/8aea7435b888164e8563
-->
<script>var module = {};</script>
<script src="node_modules/cssman/main.js"></script>
<script>
(function() {
addLibrary('chromium/DOMPresentationUtils', function (element) {
return module.exports(element, false);
});
})();
</script>
<!-- https://github.com/Autarc/optimal-select -->
<script>
(function() {
require(['OptimalSelect'], function (OptimalSelect) {
addLibrary('autarc/optimal-select', function (element) {
return OptimalSelect.select(element)
});
});
})();
</script>
<!-- https://github.com/antonmedv/finder -->
<script src="temp/finder/index.js"></script>
<script>
(function () {
addLibrary('antonmedv/finder', function (element) {
return finder.default(element);
});
})();
</script>
</head>
<body>
<h1>CSS Selector Generators Benchmark</h1>
<p>This test attempts to compare various JS libraries for generating CSS selectors of HTML elements. Each library is optimized for something else, e.g. speed, browser compatibility, selector length, etc. If some library does not have good score in some
category, it does not mean that the library is rubbish.</p>
<h2>How it works</h2>
<ul>
<li>There's some complex HTML code below.</li>
<li>Each library has to go through all elements and make a unique CSS selector for it.</li>
</ul>
<h2>Results</h2>
<button onclick="runTests();">Run tests</button>
<table>
<thead>
<tr>
<th>Library</th>
<th>Valid</th>
<th>Invalid</th>
<th>Not found</th>
<th>Non unique</th>
<th>Not matching</th>
<th>Longest selector</th>
<th>Duration</th>
</tr>
</thead>
<tbody id="results"></tbody>
</table>
<div style="display: none;">
<h2>Testing HTML code</h2>
<div id="wrap">
<header class="navbar navbar-static-top">
<nav class="navbar-inner">
<div class="container">
<a href="/" class="brand">Inline<strong>Manual</strong></a>
<ul class="nav main-nav">
<li class="divider-vertical"></li>
<li class="active"><a class="" href="/dashboard" title="dashboard"><i class="icon-th"></i></a></li>
<li class="divider-vertical"></li>
<li class="" id="nav-topics"><a href="/topics" title="topics"><i class="icon-book"></i> Topics</a></li>
<li class="divider-vertical"></li>
<li class="" id="nav-sites"><a class="" href="/sites" title="sites"><i class="icon-globe"></i> Sites</a></li>
<li class="divider-vertical"></li>
<li class="" id="nav-search"><a class="" href="/search" title="search"><i class="icon-search"></i> Search</a></li>
<li class="divider-vertical"></li>
<li class="" id="nav-support"><a class="" href="/support" title="support"><i class="icon-info-sign"></i> Getting started</a></li>
<li class="divider-vertical"></li>
</ul>
<div class="nav-account pull-right">
<ul class="nav">
<li>
<div class="btn-group">
<a class="btn" href="/admin"><i class="icon-wrench"></i> Administration</a>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href="/admin">
<i class="icon-th-large"></i> Dashboard
</a>
</li>
<li class="divider"></li>
<li>
<a href="/admin/topics">
<i class="icon-book"></i> Manage topics
</a>
</li>
<li>
<a href="/admin/invitations">
<i class="icon-envelope"></i> Manage invitations
</a>
</li>
<li class="divider"></li>
<li>
<a href="/admin/users">
<i class="icon-user"></i> Manage users
</a>
</li>
<li>
<a href="/admin/activities">
<i class="icon-road"></i> Users activities
</a>
</li>
<li class="divider"></li>
<li>
<a href="/admin/organizations">
<i class="icon-group"></i> Manage organizations
</a>
</li>
<li class="divider"></li>
<li>
<a href="/admin/sidekiq" target="_blank">
<i class="icon-spinner"></i> Manage background jobs
</a>
</li>
</ul>
</div>
</li>
<li>
<a href="/profile" class="user-avatar-link">
<img src="https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=30" class="user-avatar" />
</a>
</li>
<li class="account-li">
<a href="/profile" title="my account">marek</a>
</li>
<li class="account-li">
<a href="/users/logout" data-method="delete" title="sign-out"><i class="icon-off"></i></a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div id="main" role="main">
<div class="container">
<div class="main-content">
<div class="row">
<div class="span12">
<div class="row">
<div class="span8">
<h2>What's happening</h2>
<ul class="unstyled">
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="30">
<a href="/profile/marek">marek</a> committed 3 times to
<a href="/topics/22">Out of the box file handling</a>
<br />
<span class='muted' title="2014-02-07 13:12">4 days ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="18">
<a href="/profile/marek">marek</a> committed 12 times to
<a href="/topics/21">test 2</a>
<br />
<span class='muted' title="2014-02-05 10:07">6 days ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="16">
<a href="/profile/marek">marek</a> committed 2 times to
<a href="/topics/22">Out of the box file handling</a>
<br />
<span class='muted' title="2013-10-04 19:20">4 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="15">
<a href="/profile/marek">marek</a> committed to
<a href="/topics/27">test moodle</a>
<br />
<span class='muted' title="2013-10-04 18:16">4 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="12">
<a href="/profile/marek">marek</a> committed 3 times to
<a href="/topics/22">Out of the box file handling</a>
<br />
<span class='muted' title="2013-09-16 07:31">5 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="11">
<a href="/profile/marek">marek</a> cloned topic from
<a href="/topics/27">test moodle</a>
<br />
<span class='muted' title="2013-09-14 23:52">5 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="10">
<a href="/profile/marek">marek</a> created new topic
<a href="/topics/23">test moodle</a>
<br />
<span class='muted' title="2013-09-13 17:51">5 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="5">
<a href="/profile/marek">marek</a> committed 5 times to
<a href="/topics/22">Out of the box file handling</a>
<br />
<span class='muted' title="2013-09-13 10:14">5 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="4">
<a href="/profile/marek">marek</a> created new topic
<a href="/topics/22">Out of the box file handling</a>
<br />
<span class='muted' title="2013-08-09 10:55">6 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="3">
<a href="/profile/marek">marek</a> created new topic
<a href="/topics/21">test 2</a>
<br />
<span class='muted' title="2013-08-09 10:51">6 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="2">
<a href="/profile/marek">marek</a> created new topic
<a href="/topics/19">test</a>
<br />
<span class='muted' title="2013-05-08 14:16">9 months ago</span>
</div>
</div>
</p>
</li>
<li>
<p>
<div class='row'>
<div class='span1' style='width: 42px'>
<img class='img-rounded' src='https://secure.gravatar.com/avatar/c52fd12777c01fb592572644cfe091a4?s=36' />
</div>
<div style='margin-top: -2px; margin-left: 5px' data-activity-id="1">
<a href="/profile/marek">marek</a> created new topic test
<br />
<span class='muted' title="2013-05-08 06:08">9 months ago</span>
</div>
</div>
</p>
</li>
</ul>
</div>
<div class="span4 sidebar">
<div class="well">
Read our latest <a href="/blog">blog</a>.
</div>
<!-- Organizations -->
<div class="block clearfix">
<div class="block-header clearfix">
<h3 class="block-title"><i class="icon-group"></i> Organizations</h3>
<div class="block-action"><a href="/organizations/new" class="btn btn-success btn-small"><i class="icon-plus icon-white"></i> Create organization</a></div>
</div>
<div class="block-content">
<ul class="listing unstyled">
<li>
<a href="/profile/atomicant2">atomicant2</a>
</li>
<li class="show-all"><a href="/organizations">Show all</a></li>
</ul>
</div>
</div>
<!-- /Organizations -->
<!-- Your topics -->
<div class="block clearfix">
<div class="block-header clearfix">
<h3 class="block-title"><i class="icon-book"></i> Your topics</h3>
<div class="block-action"><a href="/topics/new" class="btn btn-success btn-small"><i class="icon-plus icon-white"></i> Create topic</a></div>
</div>
<div class="block-content">
<ul class="listing unstyled">
<li>
<i class="icon-lock"></i>
<a href="/topics/22">Out of the box file handling</a>
</li>
<li>
<i class="icon-eye-open"></i>
<a href="/topics/27">test moodle</a>
</li>
<li>
<i class="icon-eye-open"></i>
<a href="/topics/26">test</a>
</li>
<li>
<i class="icon-eye-open"></i>
<a href="/topics/25">test</a>
</li>
<li>
<i class="icon-eye-open"></i>
<a href="/topics/19">test</a>
</li>
<li class="show-all"><a href="/topics">Show all</a></li>
</ul>
</div>
</div>
<!-- /Your topics -->
<!-- Starred topics -->
<div class="block clearfix">
<div class="block-header clearfix">
<h3 class="block-title"><i class="icon-star"></i> Starred topics</h3>
</div>
<div class="block-content">
<ul class="listing unstyled">
<li>
<i class="icon-eye-open"></i>
<a href="/topics/4">Officia Esse Et Ea Velit</a>
</li>
<li class="show-all"><a href="/topics?scope=starred">Show all</a></li>
</ul>
</div>
</div>
<!-- /Starred topics -->
<!-- Recently created public topics -->
<div class="block clearfix">
<div class="block-header clearfix">
<h3 class="block-title"><i class="icon-asterisk"></i> Recently created public topics</h3>
</div>
<div class="block-content">
<ul class="listing unstyled">
<li>
<i class="icon-eye-open"></i>
<a href="/topics/29">Drupal topic</a>
</li>
<li>
<i class="icon-eye-open"></i>
<a href="/topics/28">How to create an Article With a longer title</a>
</li>
<li>
<i class="icon-eye-open"></i>
<a href="/topics/27">test moodle</a>
</li>
<li>
<i class="icon-eye-open"></i>
<a href="/topics/26">test</a>
</li>
<li>
<i class="icon-eye-open"></i>
<a href="/topics/25">test</a>
</li>
<li class="show-all"><a href="/topics?scope=public">Show all</a></li>
</ul>
</div>
</div>
<!-- /Recently created public topics -->
</div>
<!-- /sidebar -->
</div>
<!-- main content -->
</div>
</div>
</div>
<!-- end of .main-content -->
</div>
<!-- end of .container -->
</div>
<!-- end of #main -->
<div id="push"></div>
</div>
<!-- end of #wrap -->
<div id="footer">
<div class="container">
<div class="row">
<div class="span4">
<p class="muted credit">© Inline Manual 2014.</p>
</div>
<div class="span8 footer-nav">
<ul class="nav nav-pills">
<li><a href="/">Home</a></li>
<li class=""><a href="/features">Features</a></li>
<li class=""><a href="/pricing">Pricing</a></li>
<li class=""><a href="/blog">Blog</a></li>
<!-- <li class=""><a href="/faq">FAQ</a></li>
-->
<li class=""><a href="/about_us">About Us</a></li>
<li class=""><a href="/jobs">Jobs</a></li>
<li class=""><a href="/contact">Contact</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</body>
</html>