« first day (427 days earlier)      last day (4536 days later) » 
00:00 - 15:0015:00 - 00:00

12:01 AM
@Raynos I'm getting an error. "Cannot find module coffee-script"
O_O
 
I see
That means npm install -d doesn't like you :\
 
Oh noes :-(
 
Did it give you a sensible error?
 
Not really. I got the error above, and a call stack.
There's something on npm install -d that says bugs['web'] should probably be bugs['url']
 
Worked for me :\
node --version
npm --version
 
12:04 AM
node: 0.6.6
npm: 1.1.0-beta-4
 
same as me :\
does npm install -d end in ok?
Quick and dirty fix is npm install coffee-script -g
 
It ends in npm info ok
 
Other then that I can't tell why it wont work :\
 
I'll screw around with it
 
Scrolls back
@ryan I installed node on windows today. No issues. Sorry, that doesn't help you!
 
12:16 AM
Ooh, building :-)
 
that file rebuilds when the file system changes
so the fact it never terminates is not a bug :p
generally it will finish microseconds after it prints building
you should be able to open tests/test.html in a browser now
 
So... what happens if I Ctrl-C out of it? Is that a Bad Thing?
 
No it's not
It just kills the file watcher
 
Fair enough
 
I mean it sends a SIGKILL to the node process and it just collapses
its a bad thing when you do it on a http server you dont want to take down :D
 
12:19 AM
Gotcha
Look at all those pretty green tests :-)
 
Yeah
they should all work
except ff3.6 :D
but ie8 should work
 
lol
Well, it's working. That means I can go get some food :-)
Node does everything right?
node what-should-i-have-for-dinner
 
well node build.js builds the shim and watches on file changes to rebuild
Oh ehm your having a joke
node can do anything you want ;)
just like C can do anything you want ;)
 
Java can't do anything you want.
 
does the name attribute mess up getElementById in old IE
apparently yes
 
12:29 AM
node build-a-thai-place-in-my-town
 
@user886931 yes
 
Anyway, dinner :-)
 
i was looking at sizzle fails the basics and trying to remember why i took gEBI out of my selector thing
and that was why
 
user1385191
kind of funny how sizzle is slower than jQ
 
but maybe it would be better to just use gEBI and then check everything it returns to make sure it actually has matching id attribute
 
user1385191
12:31 AM
...
 
user1385191
why wouldn't it?
 
i think it would
i wasn't really thinking about that when i wrote it
just treated id like any other attribute
 
user1385191
there's some age-old name-id bugs that I've yet to test
 
user1385191
but other than that, getElementById is basically bulletproof
 
it's always IE
gEBI, gEBCN, etc
can't use any of it
 
user1385191
12:33 AM
this was around IE 4-5, IIRC
 
gEBCN was not in IE like forever
 
IE is bad...
 
Are you sure gEBI is O(1)? Because if there are multiple elements with the same id, the first one is selected/
And it's not very hashtable-like
 
yeah that brings up another thing
 
user1385191
I didn't make the first point, but the latter I'd like explained
 
12:35 AM
even though having duplicate ids is incorrect, what happens if you do have a document with two ids and select "#dupes"
should you get both, or just the first one?
 
user1385191
one
 
why the last?
you'd think it would be better to find the first and quit early
ugh
this chat
i swear
 
You get the first element with that id
 
user1385191
I was thinking in a hash frame of mind
 
like in native QSA?
 
user1385191
12:37 AM
in which the last instance would overwrite the former instance
 
@Zirak ...
 
hmm yeah so gEBI really won't work
because it only returns one
 
Trivial implementation is to have the value of the hashtable to be a linked list
 
user1385191
...which it should
 
But that shit is not specificied
 
12:37 AM
and that could be a false one with a matching name attrib
 
and clearly undefined behaviour
 
user1385191
after all, the verb is singular
 
if you have multiple same id's in firefox you lose the hash table benefit
 
23 secs ago, by Raynos
and clearly undefined behaviour
 
12:38 AM
@Zirak If you have an element with an id="id", window.id will refer to that element
 
Can we avoid going on a tangent and talkign about UB
 
in some browsers
 
user1385191
hey, tinkerbin works in Opera 11.60 now
 
user1385191
must have a bunch of es5 magic
 
@Raynos Yes, but I'm just curious. People tell me it's a hashtable, but this behaviour isn't hash-table-like
 
12:39 AM
@Zirak read the source, then link it to us
 
bbbutbut
 
Seriously apart from @gsnedders none of us can sensibly tell you what it does
 
this is from webkit source stackoverflow.com/questions/2711303/…
 
@Esailija :D
 
hmm interesting
i guess there's no good way to capability-test if gEBI is broken
other than creating dom nodes and crap
 
12:46 AM
exactly
var frag = document.createDocumentFragment();
var div = document.createElement("div");
div.setAttribute("name", "foo");
frag.appendChild(div);
var documentGetElementByIdIsBroken = frag.getElementById("foo");

if (documentGetElementByIdIsBroken) {
    var oldGetById = document.getElementById;
    Object.defineProperty(document, "getElementById", {
        value: function _getById(id) {
            var el = oldGetById.call(document, id);
            if (e.getAttribute("id") === id) {
                return el;
 
yuck
 
It won't be broken in browsers that have defineproperty or allow doing getById.call
just saying
=D
 
i could still use it, double check the id attrib each time, and if it ever doesn't match, mark it as broken so it won't be used again
also i wonder how gEBI can use the hash if it's called on something other than document
like if the selector was ".myclass #special"
 
It doesn't make sense to call getElementById on something other than document
 
@Esailija >:(
 
12:55 AM
Zirak how would you handle a constructor like ".myclass #special"
 
The easiest solution to be honest is fix your damn markup
 
it's an example
 
when would you have two different elements where one has id X and other has name X
This bug should never happen in semantic html5
 
You do document.getElementById( 'special' ). tada
 
it doesn't matter, i'm saying if you want to write a thing that evaluates selectors, you can't just tell people to fix their markup
 
12:56 AM
sure you can
 
Zirak but that will give false positive if there wasn't myclass
 
its called
not my fucking problem
 
You can then, if you wish, check if the ancestors for a classname myclass
 
:D
 
Zirak that's a good idea
 
12:57 AM
of course it is. that's how right->left selector parsing works :)
 
man I want to write some nice code :(
 
is that how it's usually done? i did it from left to right
 
There are and there are.
 
wut
 
IIRC, the css spec talks about right->left parsing
 
12:59 AM
hmm
 
But there are some selector engines parsing left->right
 
yeah it just made sense to me to do it left to right
but for ids if they're hashed right to left sounds better
 
is there anything you can do with XSS other than pass document.cookie which is completely worthless in modern browser because of HttpOnly cookies?
 
window.location.href = 'http://embarrasingporn.com'
 
but that's an annoyance at best
 
1:01 AM
Every time you visit a page being redirected to embarrasingporn.com ? that's more than annoyance
 
I don't mean having a site that actually hosts XSS lol
I mean clever GET strings you can link to people and then they get XSS'd
 
hey there
i have a for loop that creates a string of tr elements
 
sure
 
why can i not stop laughing right now
 
but i can't put the string into an element
as html
 
1:08 AM
I thought you didn't have sense of humor :P
 
i tried jquery's html()
and doc.getelementbyid.innerHTML = '
 
apparently i do
 
to no avail
does anyone know the problem?
 
show me teh codez
 
  var cards = <?php
      $cards = $_GET['cards'];
      $c = explode("-", $cards);
      echo json_encode($c);
  ?>;
  for(var i=1;i <= <?php echo count($c); ?>/3;i++)
  {
      var append = "<tr><td>" + cards[3*i-3] + "</td><td>" + cards[3*i-2] + "</td><td>" + cards[3*i-1] + "</td></tr>";
      console.log(append);
  }
also, if there's a better way to get every third element in the array, etc, let me know
 
1:10 AM
wait where am i
 
that's the best i could come up with for now
 
does the console.log append look normal
 
oh, and i tried appending inside and outside the loop
again to no success
yes it looks fine
the string is generating and everything
but i just can't do any other javascript other than console.log, alert, confirm, prompt, etc
 
why don't you just append dom nodes
 
document.createElement?
i probably should shouldn't i
 
1:12 AM
yeah
 
i guess i was just looking for the easy way out
let me try that
 
this mixing of php and js os also really awkward
 
not really
i'm just putting the get variable into javascript
just skipping a step rather than making a get function with JS
 
well at least create a js var and assign it to <?php echo count($c); ?>
 
oh i see
yeah i'll do that
cause it's recounting through every iteration, blah blah blah
 
1:16 AM
it's not though
it's just confusing
(case in point)
 
var cards = ["4","Bank_of_America","$1000.00","7","Capital_One","$900.00"];

for(var i=1;i <= 6/3;i++)

{

$("<tr>")

.html(

$("<td>").html(cards[3*i-3]);

$("<td>").html(cards[3*i-2]);

$("<td>").html(cards[3*i-1]);

)

.appendTo("#verify");

}
this didn't work either
 
dom nodes.
 
would this work:
var tr = document.createElement("tr");
tr.createElement("td").innerHTML = "blah";
tr.createElement("td").innerHTML = "blah";
tr.createElement("td").innerHTML = "blah";
 
wow
didn't think of that >.>
thank you!
 
1:29 AM
Stop abusing innerHTML when you want to set text...
 
@Zirak if we are refactoring why didn't you just use an array of objects instead (as in proper JSON :D)
 
Didn't know what each ment
Could be arbitrary for all I know
 
anyways I just took his code and changed it to work asap in hopes he would go away =D
 
There should be a short tutorial on how to not suck at the DOM
 
there's so many letters in document.create
do i really have to type it all
where are my snippets
 
1:35 AM
I write about 80 words per minute. The average IIRC is about 70. It doesn't make a difference.
Besides, with auto-completion and code hinting and all that crap...
 
yeah for sure
this right to left business is changing my whole view on selectors
 
If you really want : var d = document; d.m = d.createElement; huzzah!
d.m( 'tr' );
 
function dce(e){return document.createElement(e)}
function cE
 
var $ = function ...
 
hmm
never mind
 
1:38 AM
var El = {
    make: ...
    findById: ...
    findByClass: ....
    findByTag
}
so it could be var div = El.make("div")
:P
 
What's really killing me is that I can't have lib.dom.name
 
what is all tht for
 
DOM sugah
 
ah
function cE(e){return document.createElement(e)}
function gEBI(id){return document.getElementById(id)}
function gEBN(n){return document.getElementsByName(n)}
function gEBCN(n){return document.getElementsByClassName(n)}
function gEBTN(n){return document.getElementsByTagName(n)}
there u go
everything you need
 
you don't really need getElementsByName for anything
 
1:42 AM
...and some stuff you do't need
 
you can dot access by name under a form
 
Falling asleep on keyboard = brain telling me something
 
time to sleep?
 
lmfao
` //to be honest, I copy + pasted this from the previous function, and changed tagName -> `name``
best comment ever
 
:D
Like all comments, this suffers from decay as well. I since figured that everything has getElementsByTagName, so no need to implement it myself
 
1:45 AM
nice haiku comment
 
Thank you. I like to keep my source code interesting with comments
 
interesting is a good word for it
 
hahah and its like the only comment in the whole file
 
LOL
 
1:48 AM
anyways, magical time! gnight/day/evening/madam
 
 
2 hours later…
4:14 AM
0
Q: Dave's WordPress Live Search

scfergI'm using the Dave's WordPress Live Search plugin and I've run into a problem... My blog's navigation has a position: fixed and is at the top of the screen. The search field is also in that navigation bar. The search results appear in the correct location (right below the input field) with pos...

 
4:33 AM
RT @mrdoob: This is like Flash IDE but right in the browser. Using SVG? https://www.mugeda.com/animation/edit/1263 /via @ChromeExp
 
5:09 AM
RT @scottjehl: "Multi-Device Web Design: An Evolution" - great stuff from @lukew http://www.lukew.com/ff/entry.asp?1436
RT @awesomekling: Cached HTMLCollections in #WebKit for your memory-saving pleasure: http://trac.webkit.org/changeset/103115
 
5:21 AM
“Cache and reuse HTMLCollections” http://trac.webkit.org/changeset/103115 @awesomekling “reduces memory… by ~800 kB… when loading the full HTML5 spec“
 
 
1 hour later…
6:42 AM
RT @stoyanstefanov: Performance calendar day #16: @bbrewer (@bluesmoon's partner in crime) on DIY RUM with GA and Navigation Timing http ...
 
6:54 AM
Firefox Nightly supports the loop attribute on HTML5 video and audio elements http://msujaws.wordpress.com/2011/12/16/more-enhancements-for-html5-video-and-audio-in-firefox/ from @weinjared
 
7:07 AM
RT @bbrewer: My Performance Calendar post is up: A Practical Guide to the Navigation Timing API http://calendar.perfplanet.com/2011/a-practical-guide-to-the-navigation-timing-api/ #wpo #webperf
 
7:17 AM
var display_message="";
$('input:checked').each(function(index) {

var profile_id=$(this).val();
$.ajax({
type: 'post',
url: 'myUrl',
data: data,
success: function(data) {
if(data=="ok")
display_message = display_message + data +", ";
}
});
});

alert(display_message);
alert(display_message);

if($.trim(display_message)!=""){
jAlert("Your birthdate already exits in "+display_message.substring(0, display_message.length - 2)+".", "Bdate");
return false;
}
in this code, i use two alert-box for display display_message variable value. when i run successfully this code, in 1st alert-box i get blank value and second alert-box i get value which i needed, then it will go in if condition. if i doesn't use alert box then it will always take null value in display_message variable and never enters into the if condition. so what i need to change to run this code without alert box?
 
7:31 AM
“CityPlug: An experiment with CSS Frameworks” http://blog.spade.be/cityplug-an-experiment-with-css-frameworks-111 from @spade_be
 
7:43 AM
Y U not let us make our own web browser?? http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-December/034216.html
 
7:55 AM
Y U not let us make our own web browser?? http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-December/034216.html see http://mozillalabs.com/chromeless https://bugzilla.mozilla.org/show_bug.cgi?id=693515
 
 
3 hours later…
11:10 AM
One $ to rule them all,
One $ to find them,
One $ to bring them all,
and in the DOM bind them.
 
11:37 AM
self.hurl($, fieryChasmOfMountDoom);
 
11:48 AM
MMMMYYYY PRECIOUS
 
12:01 PM
can any body tell me how stackoverflow chat works?
any links for the same?
 
Care to be more specific? It's made of several components.
Like any other non-trivial program
 
i just want to know when it was launched and how rooms are created.
is it based on tags
?
 
People can create rooms. There's a rep req for that, IIRC
 
12:03 PM
thanks Zirak
 
np at all
 
So Zirak, how you think this chat functionality helps the users of stackoverflow?
 
@JobyJoseph A lot of us hang around here almost all day, so it helps a lot of us procrastinate
 
great!
 
I'm not sure how to get you. Why do you ask?
 
12:09 PM
Just to understand how others think of a new functionality.
I am a person doing research in web field
 
It's been around for some time, certainly before I registered.
 
ok nice
 
And it's a chat room. People say js related or just random things, others flame them or agree with them (former happens more often than latter (naturally.))
 
wants an Object.keys( obj, cb )
 
12:52 PM
@Zirak lol yesterday I had to read all the files just cos the code was so funny :d
 
:D
amagad, 2 minutes until I can play Pokémon White
 
1:22 PM
gist: Basic DOM element manipulation, 2011-12-17 13:21:35Z
//creating an element is easy peasy
var divElem = document.createElement( 'div' );

//divElem is now a div element. it's not related to the any other element or
// node, it's free-range.

//to add it to the body element, for example:
document.body.appendChild( divElem );
//splendidsimo!

//setting the properties of the element is as easy as editing any other object
divElem.id = 'chuckNorris';
//or:
divElem[ 'id' ] = 'chuckNorris';

document.getElementById( 'chuckNorris' ) === divElem;

//the only exception is class names. instead of simply saying
// divElem.class = 'greasedLightning', we have to do
divElem.className = 'greasedLightning';
//not a big hindrance, though. it's because class is a reserved word in js, so
// you can't use it in dot notation

//not comes the annoying part: cross-browser compatibility. some of you may be
// wondering in ever-so-surprised faces, "but how do we set an element's text?
// huh? huh!? HUH!? YOU CROOK, YOU PROMISED US KNOWLEDGE YOU SON OF A BI-"
// worry not, you weird purple-faced man!

//the w3c, WWW Consortium, says that the textContent property of an element
// is, well, its text property.
//so, to get the text of the head element:
document.head.textContent;
//and set it:
divElem.textContent = 'Spidermonkey';

//Chrome, firefox, opera and safari all conform to this standard
//however, Internet Explorer says "I MAEK OWN STANDARDS", doesn't conform to
// the standard, and instead offers an innerText property
document.head.innerText;
divElem.innerText = 'Spidermonkey';

//the only browser not supporting this property (at the time of writing) is FF.
//"help us, oh please help us! we are not strong enough to make this work!"
// fear not, now-green-faced citizen! here's a way to make a cross-browser
// element-text-setting function:
var text = (function () {

	//create a div element, and test whether it has a textContent property
	//if it does, set textProp to 'textContent', otherwise set it to 'innerText'
	var textProp = 'textContent' in document.createElement( 'div' ) ?
		'textContent' : 'innerText';

	return function ( elem, text ) {
		//if a text parameter is passed, set the element's text
		if ( text !== undefined ) {
			elem[ textProp ] = text;
		}

		//return the element's text
		return elem[ textProp ];
	};
}());

text( divElem ); //"Spidermonkey"
text( divElem, 'One div to rule them all'); //"One div to rule them all"

//HOWEVER! at times you may want to just add a certain piece of text to an
// element. instead of doing
text( divElem, text(divElem) + ' smurfs' );

//there's a standard, cross-browser, sexy way
//text is also a type of element, called a Text Node. creating one is nearly
// like creating any other element:
var textNode = document.createTextNode( ' smurfs' );
divElem.appendChild( textNode );

//"but what if I want to set the text node's value to something else!?"
textNode.nodeValue = ' something else';
//"amazing!" indeed it is, you weird man

//as an excercise, let's say you want to turn this:
var pokemon = [
	{
		name : 'Psyduck',
		level : 42,
		nickname : 'hickie' //it's a long, sad story
	},
	{
		name : 'Mankey',
		level : 42,
		nickname : 'The Raging Bull'
	}
];

//into this:
/*
<table>
<tbody>
	<tr>
		<td>Psyduck</td>
		<td>42</td>
		<td>hickie</td>
	</tr>
	<tr>
		<td>Mankey</td>
		<td>42</td>
		<td>The Raging Bull</td>
	</tr>
</tbody>
</table>
*/
var table = document.createElement( 'table' ),
	tbody = document.createElement( 'tbody' );

table.appendChild( tbody );
pokemon.forEach(function (poke) {
	var tr = document.createElement( 'tr' );

	for ( var detail in poke ) {
		if ( poke.hasOwnProperty(detail) ) {
			var td = document.createElement( 'td' );
			td.appendChild(
				document.createTextNode( poke[detail] )
			);
			tr.appendChild( td );
		}
	}

	tbody.appendChild( tr );
});
@Esailija Any comments on code? I know I should do some refactoring and some cleaning, but anything special you noticed?
((referring to lib, btw))
 
is it some kind of tutorial file
 
The one I posted now? Yes. Ranted yesterday about lack of how-to-not-absolutely-suck-at-DOM-tutorial, so I made one today
Covers the 2 most used things: Making elements and setting their properties
 
Well nothing popping out there for me as bad
=)
 
The last bit in the tutorial will probably intimidate some..."ohhh too verbose y u no use innerHTML so not verbose stuff thingy mushmush"
 
Well personally I'd just create a fragment from html string and appendChild that
but it requires custom code so it doesn't fit tutorial nature
 
1:32 PM
Well, we can say "here's a doc fragment, it does this, here's some code"
 
1:48 PM
You could use createTextNode, that's cross browser. Verbose though.
 
@adscriven Scroll down the file
 
@zirak, oh yeah, sorry my fault, reading this on my phone and didn't see that.
 
oh, and there are two kinds of verbose: Over-engineering verbosity and clean verbosity. Over-engineering is taking something trivial and making it verbose (checkWhetherItsAnElementOrNot), but clean verbosity takes something and makes it absolutely clear what's going on, without redundancies.
document.create? What does it create? A document?
 
element.make
makes an element
=D
 
I'm actually in favor of Element.create
 
1:56 PM
sure but Element is taken
I'd love the capital case as well but :(
 
Or something of the likes (NOT new Element Q_Q)
 
element.create element.make both are very short and extremely clear :)
imo at least :(
 
You can always say "fuck you, IE8-" and Element.create = function () { document.createElement.apply( document, arguments ); };
 
:D
 
what is the syntax for images[0].src= (the root folder,is it in single or double apostrophe?)
 
1:57 PM
why not just return document.createElement(arguments[0])
 
can anybody give me sample syntax for it
 
@Esailija You can do that. I was just having a paranoid moment.
 
images[0].src ='/images/thumbs/prolineThumb.jpg'; this dont work
 
@Saber Usually /something/ says "something folder in root folder". in js, strings can be both ways, so that's not the source of the error
If you want the something folder from the current one, you can do something/ or ./something/
 
ok.thanks
hmm...is there any way i could change the values here via javascript
<li><a class="zoomThumbActive" href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './images/UniwinView.jpg',largeimage: './images/Uniwin.jpg'}">
i wanna change the small image location and largeimage location
 
2:02 PM
ew
javascript:void(0)? lolwut?
 
make the rel just some identifier string and store the object in js
 
well i just got this from a jqzoom plugin and template
 
<a href='#'> won't kill you
 
ok.
 
Or even change it to <a href=''> and override the click functionality to prevent-default
Regarding the rel attribute...you shouldn't have any js logic inside of html
 
2:05 PM
or not use anchor at all because it's not a link ;o
 
Set it dynamically
 
what a shit plugin, the rel could just as well be rel="gal1"
and then the plugin would match that with a js object
 
//maybe something like
zoomPlugin.registerGallery({
    name : 'gal1',
    smallImage : 'meep.jpg',
    largeImage : 'largemeep.jpg'
});
 
hmm.ok.let me give it a try
 
2:23 PM
(Microsoft adds auto-update to IE)
 
what is zoomPlugin.registerGallery
finally! IE will soon not be a burden anymore
hopefully that plan works
 
It's a small step for Microsoft, but a giant leap....
 
2:37 PM
why would mozilla implement optional auto updates
sigh
@Raynos why u trolls me
 
@Esailija why u tell him to reinvent wheel
 
I didn't mean to literally write it yourself
I was aware someone had done it before but too lazy to google
 
Pokemon is so much fun <3
 
Guys I trying to do something in js. Can you help me ?
 
If you're trying to melt someone's brain with js, it won't work without complementing hardware.
 
2:54 PM
I am using ajax to get my post content into the content_div. The thing is that after that, I want to use JS to look for mp3 links and replace it with an download img
inside that content_div
 
What does a response look light?
 
like this : <p><a href="blabla.mp3"><a href="blabla.mp4"></p><p><a href="blabla.mp3"><a href="blabla.mp4"></p>
 
There's always the search for url ending with .mp3 and replace it with some element, but if your response is something like an array of links, it'll be easier.
 
Actually I had a code for adding an inline mp3 player next to each mp3 links, I tried to modify it for this goal but I can't manage to make it work
 
oh, that's fairly easy then. then do what you do to add the response to the div, loop over all the anchor elements inside, if you see one with an href ending in .mp3, replace it with your download element.
 
2:57 PM
It's not just that
I want to make a few other things too
 
Like?
 
Did you see the above code ? I want to convert it something like this actually :
 
0
Q: Should I use CSS instead of JavaScript? [as much as possible]

A TI always veto JavaScript by using CSS as much as possible. i.e. I create tabs and rollover buttons using CSS rather than JavaScript. I have seen some solutions—specifically the Wt web-framework—which advocate JavaScript; but gracefully downgrade to CSS if the browser isn't capable/js-disabled. ...

 
<tr><td><img src="blabla.png"></td><td><img src="blabla.png"></td></tr>
Eventually like this :
<tr><td>blabla<img src="blabla.png"></td><td>blabla2<img src="blabla.png"></td></tr>
 
00:00 - 15:0015:00 - 00:00

« first day (427 days earlier)      last day (4536 days later) »