« first day (208 days earlier)      last day (2926 days later) » 

8:28 AM
@Kyll Is there a function in JavaScript that can handle hover event like $(...).on() in jQuery? For example:
$("#id").on({
    mouseenter: function () {
        console.log('mouse is entering');
    },
    mouseleave: function () {
        console.log('mouse is leaving');
    }
});
Is there any way to do it without jQuery? ^^
 
9:03 AM
@KevinGuan Well yeah
document.getElementById('id').addEventListener('mouseenter', cb)
document.getElementById('id').addEventListener('mouseleave', cb2)
Plop, also =D
@Kevin You may be interested in developer.mozilla.org/en-US/docs/Web/Events
 
 
2 hours later…
10:50 AM
@Kyll Plop! =D. And ah, they are two events in JavaScript, got it.
Looking at the link...
 
 
3 hours later…
2:05 PM
Plop!
 
2:21 PM
Anyone alive?
 
2:46 PM
plonk
 
Hey :)
 
hey, long time no see :)
 
3:40 PM
@KevinGuan It's trivial to implement a similar API
function addEventListeners(el, evs) {
  for (const ev of Object.keys(evs)) {
    const cb = evs[evName];
    el.addEventListener(ev, cb);
  }
}
I can probably squeeze it into a one-liner if I really tried
Call it like this
addEventListeners(document.getElementById('id'), {
    mouseenter: function () {
        console.log('mouse is entering');
    },
    mouseleave: function () {
        console.log('mouse is leaving');
    }
});
 
I can't wait to start with DOM manipulation with JS :P
 
@Rizier123 Be wary
The DOM is a giant singleton
Treat it as such.
 
Yup. But I'm still stack at the "Secret life of objects".
 
@Rizier123 What are you stack on?
 
Still trying to figure out how exactly all those Objects, prototypes and so on work.
 
3:49 PM
!!> function Foo(){} var f = new Foo; f.__proto__ === Foo.prototype
 
Like one thing I'm not sure yet is: Is __proto__ infinity? If I do function foo(){} console.dir(new foo); I click on everything and expand the tree and it never ends, e.g. __proto__ > __proto__ > toString() > __proto__ > bind() > ... it seems that this is infinity and never ends?!
 
@MadaraUchiha true
 
That's because __proto__ is an object
And so __proto__.__proto__ will point to Object.prototype
 
@MadaraUchiha But does that mean every object gets some functionality from the generic Object?
 
@Rizier123 Correct.
Foo.__proto__ === Function.prototype // true
Foo.__proto__.__proto__ === Object.prototype // true
__proto__ always points to the constructor's prototype
 
3:54 PM
Ah, but it is Object**.prototype** and not __proto__
 
@Rizier123 Yes, because Foo.__proto__ is an object
And objects have Object as a constructor.
!!> typeof Function.prototype
 
@MadaraUchiha "function"
 
!!> Function.prototype.constructor.name
 
@MadaraUchiha "Function"
 
!!> typeof Function.__proto__
 
3:56 PM
@MadaraUchiha "function"
 
Why is Function.prototype a function as type and not an object? I mean you also add methods to the prototype like this: functionXY.prototype.myMethod = ...
 
@Rizier123 A bit of a quirk, really
15
Q: In JavaScript, why typeof Function.prototype is "function", not "object" like other prototype objects?

weilou<!DOCTYPE html> <meta charset="utf-8"> <title>An HTML5 document</title> <script> console.log(typeof String.prototype); // object console.log(typeof Number.prototype); // object console.log(typeof Object.prototype); // object console.log(typeof Boolean.prototype); // object co...

Special case in the specs, TIL.
 
Ah okay.
(still expanding that console.dir tree) Has that an end: foo(){} console.dir(new foo);? If you expand everything.
I think that shows it better: imgur.com/jFSou1F Will there be any end to this?
 
@Kyll Solved
Daily discovery: How to center in CSS
3
 
@Kyll I love the IE section at the bottom :P
 
4:15 PM
@Kyll Plop
 
Why does nobody knows if this is infinity: chat.stackoverflow.com/transcript/message/30551144#30551144 or if it ends somewhere?
 
@Rizier123 window.__proto__.__proto__.__proto__.__proto__.__proto__ === null
huh, wait
ah no, it's correct
my console just spazzed out
 
Why 5x __proto__ times? :P And does that tree in the image has an end when I will expand all apply() > __proto__ > apply() > ...?
 
Because there are 5 levels of inheritance?
and I don't know what type of thing you have there in your image
what's the constructor function? And what's that function's prototype?
for an empty function, (new (function(){})).__proto__.__proto__.__proto__ === null
It basically always goes down to Object, and Object.prototype.__proto__ === null
 
I did this in the chrome console: foo(){} console.dir(new foo); and it seems like I can expand it to infinity, but not sure if it really is infinity
 
4:28 PM
Well in your image, you descended into __defineGetter__, which is not part of the prototype chain...
 
But like I expand it it will never end?
 
No, because foo.__proto__.__defineGetter__ === foo.__defineGetter__
you have a circular reference there
but that has nothing to do with the prototype chain anyway
 
Ah okay.
Seems so simply but I just realized it now why the constructor runs so "late" while creating an object: chat.stackoverflow.com/transcript/message/30216011#30216011 because it can't without the previous steps.
 
4:44 PM
.slice() always throws me off, since it needs 2 indices and not a index + offset like in PHP :P
 
if it was only "not like in PHP", that wouldn't be special
but it's like that in every other language I've seen so far
Always offset + len
 
 
2 hours later…
6:35 PM
@Siguza P\op!
 
Hey, whatcha been up to?
 
Not much
Well, a lot actually
Life's been changing
Thing's been happening out of that Spearrel's control
Many new fun things
What about you?
 
mostly caught up with university
apart from that, I started digging deeper into iOS
disassembling stuff and the like
playing with the kernel
 
Nice
Had fun?
 
yeah, mostly
I'm currently writing a tool to convert shared libraries into Apple's new text-based stub format thingy that noone seems to know yet
after that I can either redesign my website or find out why some hacker's low-level stuff dumping tool doesn't work on my phone
 
6:54 PM
And I still don't own a smartphone =p
ffk
 
Well if you can live without one, then that's a good thing
 
7:13 PM
> warning: & has lower precedence than !=; != will be evaluated first
WAT
 
!?
What language?
 
C
also, reading the symbol table of an object file from a non-rewindable stream is not fun
 
 
1 hour later…
Sam
8:50 PM
The Long Dark looks awesome after these updates xD
 
oh wow
not bad
 
Sam
ikr
They've added "Challenges" too.
Still waiting on the story though.
 
9:33 PM
I think I will fail at learning JS same as I did with haskell.
 
@Rizier123 Nah, JS is easy
Just ignore the edge cases and the complicated bits for now, you can get back to them later
 

« first day (208 days earlier)      last day (2926 days later) »