00:06
<zewt>
it's not too hard, typically just means treating number-like things as a single token
00:07
<zewt>
so "a1.2b" becomes a, 1.2, b, so numbers in the same logical position can compare as numbers instead of characters
00:07
<zewt>
don't know enough about locale-specific collation rules to know how it intersects with that, though
00:09
<zewt>
(and i'm sure there are smarter ways of doing it; that's just how I've done it)
00:31
<Hixie>
zewt: so split on spaces and then compare each as float if it parses as such (ignoring trailing garbage) and as string otherwise? seems non-ideal...
00:31
<Hixie>
bbiab
00:49
<zewt>
Hixie: no, search for digits (optionally followed by a period and other digits) and parse as float always
00:50
<zewt>
(exponential notation isn't very interesting in practice so i wouldn't support it here, nor inf, nan, etc)
00:52
<Philip`>
(What about negative numbers?)
00:52
<zewt>
when i've implemented it i only had to deal with integers, floats probably make it a bit trickier (eg. what do you do with "1.2.3")
00:53
<zewt>
Philip`: "-" < "0" (at least in ASCII, couldn't say about various locales), so that just works
00:54
<zewt>
(assuming number tokens sort at the same position as "0" relative to other strings)
06:31
<karlcow>
Are there geo examples of microformats using the data element?
06:36
karlcow
finds in <data class="latitude" value="38.769359">38° 46' 9.692"</data> in http://tantek.com/presentations/2012/09/microformats2/
06:36
<karlcow>
hmm not working for my pattern
07:36
<Hixie>
really not sure what to do about this number detection thing
07:36
<Hixie>
i don't want to only do numbers if it matches the valid float syntax, because then %s don't sort right
07:39
<Hixie>
i guess we could sort on float if it matches float, and otherwise split around things matching /[-+]?(?:[0-9]+(?:\.[0-9]*)?|[0-9]*\.[0-9]+)(?!\.)/
07:44
<Hixie>
maybe /(?:[-+]?(?:[0-9]+(?:\.[0-9]*)?|[0-9]*\.[0-9]+)(?!\.)|[0-9]+)/ ...
07:44
<Hixie>
though that'd be a pain to explain in the spec
17:04
<zewt>
hmm, trying to think of a way to do natural sorting that both deals with "1.2.3" in a predictable way, while treating 1.2 as a float (000001.200000) instead of a version number (000001.000002)
17:05
<zewt>
one way would be to split on digit boundaries (eg. treat strings of digits as a single token, parsing out integers), and to sort them as if they have an infinite number of 0s prefixed, unless the previous token was a '.', in which case the 0s are appended
17:05
<zewt>
which means 1.2.3 would be sorted as if it was 000001.200000.300000 ... which isn't perfect, but not terrible
17:45
<zewt>
geh, youtube somehow making copy-link-location copy a different link than firefox shows, which shouldn't be possible
17:45
<zewt>
nothing quite as obnoxious as pasting a link to someone and having it be a tracking link instead of the one you copied
19:28
<GPHemsley>
zewt: Probably the difference between onclick and href
19:29
<zewt>
i right clicked, closed the context menu and repeated a couple times and it still showed the original link
19:30
<zewt>
i didn't look much closer, except to notice it didn't seem to happen in chrome
19:54
<Hixie>
so i want [float] [units] to sort on float, and either ignore units or subsort on string, and i want a series of integers separated by punctuation to sort on those integers, and everything else i think i'm ok with doing as a string
19:57
<zewt>
seems lame if "10 foo" sorts as a number, but "foo 10" sorts as a string
19:57
<Hixie>
sorting [units] [float] as a number would be fine too
19:57
<zewt>
or "foo 10 bar 20"
19:57
<zewt>
("episode 10 part 2")
19:58
<Hixie>
i don't feel strongly about that one. you can pretty easily fake it in a <data value="" attribute
19:58
<Hixie>
if there's an easy algorithm that gets that oo, then ok
19:58
<Hixie>
too
19:59
<zewt>
i've done that, basically by picking a range and pre-expending numbers (so you get the above "000001.200000" sort of thing); it works decently but doesn't generalize (since you have to pick a maximum length in advance)
20:00
<zewt>
i sort of like how the above algorithm works out, the results of the 1.2.3 case is a little unobvious though which is annoying
20:00
<Hixie>
you can use the thing tab blogged about to not have to zero-pad
20:01
<zewt>
url?
20:01
<Hixie>
i do not recall
20:01
<zewt>
(note the zero-padding in my algorithm sketch above is conceptual--presumably you wouldn't actually allocate an infinite-length string)
20:01
<Hixie>
http://www.xanthir.com/blog/b4K70 probably
20:02
<zewt>
that's cute, but it looks like it only works if you're only sorting numbers against other numbers
20:10
<gsnedders>
CPU /stuck/ to heatsink. never seen that before. Eventually twisted it off, but knocked a couple of pins.
20:10
<gsnedders>
This is gonna be fun.
20:10
<Hixie>
i had the opposite problem the other day
20:11
<Hixie>
an ancient box i was using as a network logger had its heatsink fall clean off
20:11
<zewt>
gsnedders: i found it amusing that intel moved the pins from the cpu to the motherboard
20:11
<Hixie>
first i heard of it was when i picked up the box and heard a "clunk" as the heatsink crashed around the inside
20:11
<zewt>
which has the effect of moving warranty costs from intel to the motherboard manufacturers
20:12
<Hixie>
(didn't bother trying to save it, just sent the box to be recycled)
20:12
<gsnedders>
What I really want to bend the pins is a tiny screwdriver. Don't think there's one at my parents', however. :|
20:12
<gsnedders>
Ah, I'm trying to get this out of one computer to upgrade BIOS of new motherboard.
20:15
<gsnedders>
But the more I look the more pins I seem to have bent freeing it, depsite grabbing it by the side to free it (it came out all at once from the motherboard with the heatsink, without much force — never clamped down?).
20:25
<gsnedders>
Down to a single pin out of place, but I'm not sure I can get this back in place without bending another twenty. Eek!
20:26
<Hixie>
how important can it possibly be to have all the pins straight
20:26
<Hixie>
surely it'll work fine with one pin missing
20:27
<gsnedders>
Why have the pin there, then?
20:27
<Hixie>
redundancy
20:27
<Hixie>
(for the record, i'm being a smart ass, don't actually ignore the one pin...)
20:27
<gsnedders>
(For the record, I've been around Hixie long enough to realize)
20:27
<gsnedders>
:)
20:27
<Hixie>
just checking :_P
20:29
<Hixie>
ah, apparently we were overdue for our lake delivery
20:29
<gsnedders>
I think I've just gone from one pin being flat on the CPU to another being. I think this may be a lost cause. :(
20:29
<Hixie>
and the delivery guys decided to just drop it all at once in an air delivery
20:29
<Hixie>
gsnedders: it's not a lost cause until you snap one
20:30
<gsnedders>
Hixie: On the other hand, a £50 CPU is not worth the amount of time it might well take to sort this out.
20:30
<Hixie>
what cpu is it?
20:31
<gsnedders>
Phenom II 840
20:32
<gsnedders>
As said, trying to just put it in new motherboard to upgrade BIOS. Bah, the problems of buying new CPUs!
20:32
<gsnedders>
And I've never had taking CPUs in/out be any issue before. :|
20:41
<gsnedders>
Just as I'm about to give up and buy a Sempron to replace it (in what is theoretically my mother's computer, though she never uses any), I get the crushed pin.
20:47
<zewt>
hmm, that comparison algorithm means sorting numbers isn't stable ("2" < "2.0"), which is lame
20:47
<zewt>
or rather, it has an ordering where it shouldn't
20:47
<zewt>
oh well
20:49
<Hixie>
which one?
20:49
<zewt>
the "digit boundaries" one
20:50
<Hixie>
ah
20:50
<Hixie>
yeah, i don't think that approach works
20:50
<zewt>
tried implementing it to see what the quirks were, and that's a bad one
20:50
<Hixie>
in particular, i want to support real floats
20:50
<zewt>
having a consistent sort order (that doesn't do different things depending on where in the string you are, etc.) seems way more useful in general than supporting things like scientific notation
20:51
<Hixie>
man, AMD has a lot of processors
20:51
<Hixie>
i had no idea how out of date i was with this stuff
20:51
<zewt>
heh i stopped paying attention to processors a long time ago
20:51
<zewt>
things are fast enough
20:51
<Hixie>
"things" are by a _long_ shot not "fast enough" :-)
20:51
<zewt>
things have been way more than fast enough years ago :P
20:52
<zewt>
all i want now is things to be cooler
20:52
<gsnedders>
AMD's processors are nowadays only worth their cost if you don't care about single-threaded perf
20:52
<Hixie>
but the processors seem to have reached a point of diminishing returns in terms of raw GHz
20:54
<zewt>
also if a user really wants to sort things that are in scientific notation, he can always expand the number in an explicit sort key
20:55
<zewt>
(well, up to a point, I guess; 1e50000 wouldn't exactly be reasonable)
20:55
<zewt>
though some variant on tab's thing might work there
21:23
Hixie
wonders when he's supposed to invoke the sorting algorithm
21:31
<gsnedders>
Inevitably, eventually one pin broke :(
22:08
<annevk>
Hixie: http://sourcefrog.net/projects/natsort/
22:09
<annevk>
Hixie: maybe Unicode has defined sorting somewhere?
22:10
<Hixie>
annevk: quick comments on DOM while you're here: there are some <li>s that start with a lowercase "q" (queue a mutation record), and setAttribute()'s last <li> points to Append not Change
22:13
<annevk>
thanks
22:13
<Hixie>
natsort doesn't do floating point, unfortunately
22:14
<Hixie>
maybe that's ok...
22:14
<annevk>
https://github.com/whatwg/dom/commit/e7ce6fcc982ec4d0af6e59f22688c73f0d143c29
22:15
<annevk>
It does say "Leading zeros are not ignored, which tends to give more reasonable results on decimal fractions." and "1.001 < 1.002 < 1.010 < 1.02 < 1.1 < 1.3" which seems promising
22:15
<Hixie>
yeah (i meant things like 1.5)
22:15
<Hixie>
er
22:15
<Hixie>
1e5
22:15
<Hixie>
dvorak typo
22:15
<zewt>
i'm pretty sure it's possible to define a reasonably simple collation algorithm to get natural sorting with floats, but it'll probably have edge cases, since there's no intuitive ordering when you're mixing "1.2" floats and "1.2.3" not-floats
22:17
<annevk>
Hixie: handling that but not 2<sup>5</sup> seems weird
22:17
<zewt>
imo, trying to handle scientific notation when you don't know for sure that you have a float doesn't make much sense, since you have all kinds of false positives, like say a uuid that happens to be "12e59125-...."
22:18
<Hixie>
1e5 is supported in other places in HTML already, that's why I would like to support it
22:18
<Hixie>
i think maybe supporting it only when it's the value of <data value> might work?
22:18
<annevk>
this is user-facing text though
22:18
<Hixie>
but maybe we just forget about e
22:19
<zewt>
i'd only do it if there's some kind of context to actually say it's a float
22:19
<zewt>
<data value=1e5 type=float> or whatever
22:20
<zewt>
(if it's worth supporting at all)
22:27
<annevk>
at that point you might as well write <data value=100000>1e5</data>
22:28
<Hixie>
that becomes less plausible for things like 1e-27
22:28
<annevk>
of course with larger numbers that might get annoying
22:28
<zewt>
well, that doesn't work if you have 1e50000, but i think you can do that by normalizing it and having something like value="50000x1"
22:28
Philip`
wonders what Wikipedia does for its sortable tables
22:29
<annevk>
Philip`: http://en.wikipedia.org/wiki/Help:Sorting
22:29
<annevk>
seems they have a way to indicate the type
22:29
<annevk>
data-sort-type=""
22:30
<annevk>
sorted="1 reversed number"
22:30
<annevk>
Hixie: ^^
22:30
<Hixie>
yeah, that's always an option
22:30
<Hixie>
feels like a copout though
22:30
<Hixie>
and we don't need it to deal with <time>
22:31
<annevk>
dealing with "e" and not with the many ways people represent numbers around the globe might be a copout too though
22:31
<annevk>
ah yeah, seems Wikipedia has it mostly for <time>
22:31
<Hixie>
dealing with "e" (which i think i've bailed on) is just because that's already an HTML data format
22:32
<zewt>
Hixie: how automatic are you aiming for things to be? "1,001" < "1000"?
22:33
<Hixie>
i don't plan on dealing with non-HTML data formats (non-. decimal, thousands separators)
22:33
<rniwa>
annevk: yt?
22:33
<annevk>
rniwa: yup
22:33
<rniwa>
annevk: have a question about HTMLCollection & HTMLFormsCollection
22:34
annevk
hides
22:34
<rniwa>
annevk: what should document.forms[0].length return when there is <input name="length"> in the first form?
22:34
<zewt>
other decimals don't seem too out there as long as there's a lang tag, but since I'm annoyed by their existance in the first place i'm not going to argue that very hard, heh
22:34
<rniwa>
annevk: it appears that document.forms[0].elements.length != document.forms[0].length on Opera & ToT WebKit
22:34
<zewt>
(let cultures who won't admit that they've lost the decimal separator war use explicit sort keys)
22:34
<rniwa>
annevk: whereas document.forms[0].elements.length === document.forms[0].length on old WebKit & Firefox
22:35
<annevk>
rniwa: the latter meaning it's the actual length and not a control named that way?
22:36
<rniwa>
annevk: document.forms[0].elements.length returns the matched element in all cases
22:36
<rniwa>
annevk: document.forms[0].length is the matched element on ToT WebKit & Opera
22:36
<rniwa>
annevk: but it's the actual number of matched elements on Firefox
22:37
<rniwa>
annevk: i can't find any text in the spec where this behavior difference is made explicitly :/
22:37
<annevk>
rniwa: per spec neither interface has OverrideBuiltIns...
22:37
<rniwa>
annevk: :(
22:37
<Hixie>
zewt: this is like how cultures who have lost the language war should write everything in the world's most common language?
22:37
<zewt>
bit of a different learning curve :)
22:38
<annevk>
rniwa: given http://dev.w3.org/2006/webapi/WebIDL/#OverrideBuiltins it sounds like you're saying that should at least appear on HTMLFormsCollection
22:38
<annevk>
rniwa: which is an interface specified by HTML btw
22:38
<annevk>
rniwa: personally I'd like to defer to arv_ on this as he prolly has an informed opinion where I just like browsers to agree with each other :)
22:39
<rniwa>
arv_: ping?
22:40
<annevk>
Hixie: need to support sorting for Roman numerals :)
22:40
<Hixie>
we support sorting for them... just using an order that the romans may have found a little surprising, that's all
22:42
<zewt>
Hixie: btw. are you thinking of sorting floats actually parsed as floats (limited precision), or as arbitrary-precision floating-point strings (what I'd expect)?
22:42
<zewt>
(i'd assume the latter but just checking)
22:42
<rniwa>
annevk: oh, HTMLFormElement DOES have OverrideBuiltins.
22:42
<Hixie>
zewt: not sure what you are asking
22:42
<rniwa>
annevk: so maybe Firefox's behavior is right here.
22:42
<Hixie>
rniwa: do not assume the spec is correct
22:43
<zewt>
('0.' + '0'*1000000 + '1') < ('0.' + '0'*1000000 + '2')
22:43
<rniwa>
Hixie: well but we have a compat. issue
22:43
<rniwa>
Hixie: we can't have OverrideBuiltins on HTMLFormControlsElement
22:43
<annevk>
rniwa: that does not explain document.forms[0].elements.length not returning a the number of elements
22:43
<rniwa>
annevk: ugh... HTMLFormControlsCollection*
22:43
<rniwa>
annevk: yeah, it's our bug
22:43
<rniwa>
annevk: it's a regression i introduced :/
22:44
<rniwa>
annevk: so i need to fix that.
22:44
<annevk>
rniwa: where does HTMLFormControlsCollection have OverrideBuiltins?
22:44
<rniwa>
annevk: it doesn't.
22:44
<annevk>
okay
22:44
<rniwa>
annevk: so Firefox's correct
22:44
<rniwa>
annevk: and ToT WebKit & Opera have bugs
22:44
<rniwa>
annevk: maybe you can talk to your old colleagues to fix Opera :D ?
22:45
<Hixie>
how are you defining "have bugs"?
22:45
<Hixie>
that is, how are you determining what's correct?
22:45
<rniwa>
Hixie: we have a compat. issue filed against us
22:45
<Hixie>
ah, ok
22:45
<Hixie>
does firefox not?
22:45
<annevk>
rniwa: hmm you said document.forms[0].elements.length === document.forms[0].length was true in Firefox
22:45
<rniwa>
Hixie: HTMLFormControlsCollection can't have builtin overrides
22:45
<annevk>
rniwa: which if only the latter has OverrideBuiltins, does not make sense
22:45
<rniwa>
Hixie: Firefox implements it correctly by "length" element not overriding "length" property on HTMLFormControlsCollection
22:46
<rniwa>
annevk: no.
22:46
<Hixie>
rniwa: i understand that webkit is wrong, i'm just curious how you're determining that firefox is right
22:46
<rniwa>
annevk: document.forms[0].elements.length === document.forms[0].length on ToT WebKit & Firefox
22:46
<rniwa>
annevk: ugh...
22:46
<rniwa>
document.forms[0].elements.length === document.forms[0].length on ToT WebKit & Opera :(
22:46
<annevk>
aaah
22:46
<rniwa>
annevk, Hixie: and document.forms[0].elements.length = number of elements and document.forms[0].length = "length" element.
22:46
<rniwa>
sorry about the confusion
22:47
<annevk>
okay then yeah, if you hit compat issues the spec is correct
22:47
<rniwa>
Hixie: the way I determined is that i know that "document.forms[0].length" had to be "length" element because I remember seeing a Web compat. issue relating to that before
22:47
<annevk>
jgraham: fix it ^^
22:47
<rniwa>
Hixie: and we just got a Web. compat. issue relating to my regression that effectively added BuiltinOverride to HTMLFormControlsCollection.
22:48
<Hixie>
rniwa: k
22:48
<rniwa>
Hixie: which means DOM4 & HTML5 specification got BuiltinOverride-ness of these two objects right :)
22:48
<Hixie>
s/[45]// :-)
22:48
<zewt>
what about html5.1???
22:49
<rniwa>
Hixie, annevk: but seriously, how are we supposed to our children we've made up such a complex & convoluted system of APIs :/
22:49
<Hixie>
we didn't
22:49
<Hixie>
:-)
22:50
<zewt>
not on purpose, anyway
22:50
<Hixie>
we just specified what came before, and tried to extend it as carefully as possible
22:50
<rniwa>
zewt: i hope nobody is making up very complex APIs on purpose...
22:50
<gsnedders>
We're just making APIs that are Java-esque
22:50
<Hixie>
(all successful platforms are a disaster... win32 is the other great example)
22:50
<rniwa>
zewt: that'll be quite evil of "epic" proportion
22:50
<zewt>
not exactly
22:50
<zewt>
only if you're making it more complex than the problem requires
22:51
<Hixie>
why on earth does dragon age origins need root access to install
22:53
<gsnedders>
Because why not?
22:53
<Hixie>
burden of justification is on the side of that which wants root, i feel
23:06
<Hixie>
uh
23:06
<Hixie>
wtf
23:07
<Hixie>
html5lib failed on me in a new and unexpected manner
23:09
<Philip`>
Hixie: Maybe because users get confused if you don't install into C:\Program Files, and you need admin privileges to install there
23:09
<Hixie>
this is a mac
23:09
<Philip`>
Oh, no idea then
23:09
<Hixie>
i suspect your answer is more true than it should be though
23:09
<Hixie>
that is to say, that it was a poor port
23:17
<zewt>
maybe a favorable reason than "the installer wants to watermark your system for one-shot activation"
23:20
<Hixie>
doubt it, the license under which i got it from amazon allows me to install on any number of computers
23:35
<Hixie>
what should the CSS be for sorted="" ?
23:35
<Hixie>
or sorted tables in general?
23:41
<tantek>
isn't sorting more of a transform than a styling?
23:41
<tantek>
what's the XSLT for sorted tables? ;)
23:43
<annevk>
Hixie: there should be a pseudo-element for the triangle (if any) and some pseudo-class (or maybe [sorted] is enough, depending on how things get defined)
23:43
<tantek>
like the ::marker ?
23:43
<Hixie>
tantek: typically sorted tables have some sort of indication that they are sorted
23:43
<Hixie>
that's styling
23:44
<tantek>
like an underlined column header?
23:44
<Hixie>
annevk: i figure ::after is probably enough, if we want a triangle
23:44
<Hixie>
annevk: but yeah, i think we need a pseudo-class
23:44
<tantek>
:sorted(order)
23:44
<annevk>
Hixie: if the specification suggests ::after is used that seems fine
23:44
<tantek>
where order is a number indicated primary, secondary, tertiary etc. sort
23:45
<tantek>
1,2,3 etc.
23:45
<Hixie>
so do i just make up a pseudo-class and define it, or does it need to go in some syntax spec or something
23:45
<Hixie>
tantek: use case for the argument?
23:45
<tantek>
reflects the model in the spec
23:45
<Hixie>
that's not a use case :-)
23:45
<annevk>
Hixie: I'd coordinate with Elika and Tab on getting it in Selectors 4
23:45
<Hixie>
annevk: k
23:45
<tantek>
I'm assuming you put in multiple sort orders in the markup aspect
23:45
<tantek>
if not, then leave it out no prob
23:45
<Hixie>
anyone know if there's a bug component for selectors?
23:46
<annevk>
I think there might be
23:46
<tantek>
likely
23:46
<Hixie>
tantek: there's support for multiple keys, but i don't know of any rendering use case for indicating them
23:46
tantek
looks at iTunes
23:46
<annevk>
yup
23:46
<annevk>
https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&component=Selectors
23:47
<Hixie>
sweet
23:47
<tantek>
Hixie http://tablesorter.com/docs/
23:47
<tantek>
http://tablesorter.com/docs/#Demo in particular
23:47
<annevk>
for the arrow the pseudo-class needs at least asc/desc
23:47
<Hixie>
annevk: [sorted=~reversed] should be enough for that
23:48
<tantek>
shows some styling for multiple column sorting
23:48
<Hixie>
annevk: the problem is that there doesn't seem to be a way to match an attribute that doesn't contain a keyword that matches [0-9]+
23:48
<tantek>
given that someone has built a jQuery library for it, might as well. that's good enough of a cowpath IMO>
23:49
<Hixie>
man, that ui is wacked
23:49
<tantek>
another example: http://www.datatables.net/examples/basic_init/multi_col_sort.html
23:49
<tantek>
Hixie, feel free to spec/build a better one ;)
23:50
<Hixie>
i'm thinking only the primary key matches :sorted
23:50
<annevk>
Hixie: seems nicer if you can do :sorted(ascending) :sorted(descending) then play with [sorted=~reversed] and its negation...
23:50
<Hixie>
and if they want more, then can use [sorted] stuff
23:50
<Hixie>
annevk: yeah, probably
23:50
<zewt>
(not the "if you can't do better then you should do this, even if it's bad" argument I hope, heh)
23:51
<zewt>
multiple sort keys are usually not something exposed directly to users in my experience, but rather an automatic side-effect of sort orders provided by the author--so I generally wouldn't expect to see a UI for them
23:59
<tantek>
sounds like http://rationalwiki.org/wiki/Argument_from_incredulity
23:59
<zewt>
...
23:59
<Hixie>
filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=20522
23:59
<tantek>
in particular http://rationalwiki.org/wiki/Argument_from_incredulity#Personal_incredulity