« first day (523 days earlier)      last day (4440 days later) » 

5:03 PM
Hey. I'm positioning a div using jquery's .position() on a different div, and then .css("top", div.top); on the div I want to move. How can I detect if the div I moved is near the edge of the window?
 
So that I can position it the other side instead
 
I'm just getting out of a "answer a 40 pages call for offer in 4 hours" exercise.
 
GGG
heh sounds fun
my simple query selectors are coming along nicely. Should be a bit faster than sizzle.
i came up with a clever sheme to make them fast
and extensible
 
github?
 
GGG
5:09 PM
lol no
say you select this: "html body.foo #login button"
the first time you select that string, a Function is created
 
you're usually doing it wrong if you do this.
 
GGG
no it's fast as balls
the body of the function looks like this:
return new qs.Selection(root).getMainId("login").selectAncestorTag("body").foo.selectAncestorTag("html").checkId().getByTagName("button")
 
and what's in the qs object?
 
GGG
roughly
query selector stuff
 
is your way faster than qsa?
 
GGG
5:11 PM
you just use it like qs("html body.foo #login button") and it pops out an array of nodes
yes faster than qsa
 
user1385191
oh my that's hideous
 
GGG
well you don't see the functions it creates
 
hm... I don't know, I'm skeptic. QSA's written in C++, it should be faster than any implementation of this. If it's not, then you need to write a patch :/
 
GGG
they just go in a cache
it's faster than QSA for stuff like "#someid"
also faster for classes
since it uses getElementsByClassName if available
which is like a zillion times faster than qsa
 
why don't you just use the By object?
 
user1385191
5:13 PM
I wish selectors stayed in CSS so this whole mess could be avoided
 
GGG
@FlorianMargaine this allows arbitrary combinations of selectors
".active-panel .panel-sizer"
 
By.class('active-panel').class('panel-sizer')
 
That was awesome
 
user1385191
class selectors tend to indicate a lapse in html/logic
 
GGG
@FlorianMargaine that's essentially what this thing ends up writing
a longhand chain of individual selector functions
you can write them out like that if you want
it just converts a selector into a chain of functions like that
 
5:18 PM
Hello everybody
 
GGG
byClass doesn't solve the problem of getElementsByClassName missing in some browsers
 
Actually is the selector getElementsByClassName() there in javascript or is it some jQuery?
 
user1385191
I wouldn't call that a "problem"
 
user1385191
@JinuJD LOL
 
user1385191
exactly
 
GGG
5:19 PM
@MattMcDonald i expect abstraction layers not to need to rely on shims
 
user1385191
the selectors API was and is just the W3C pandering to novices
 
GGG
they should have the shims packaged
 
Ok..Is there a way to raise an event when a variable changes...Actually what isthe use of document.createEvent()
 
@JinuJD: document.createEvent allows you to create a DOM event that you can manually dispatch
like a MouseEvent on a button to simulate a click or something
or a KeyBoard event to simulate some writing
 
Ok....But what is the use of simulating a click when there is click event
?
 
5:25 PM
what?
 
user1385191
@JinuJD it's called a setter
 
?
 
user1385191
function setMe(newMe)
{
	newMe = String(newMe);
	me = newMe;
}
 
user1385191
once you control the access, you can act upon a change in variable value
 
user1385191
otherwise you're SOL
 
5:29 PM
You okay with that
?
 
why do you want him to go here?
 
That's another LOL issue...Just be LOL on the above chat
 
user1385191
I rarely use flags...
 
I really want to detect variable change...Is there any other way than setInterval
 
@JinuJD: he really said the solution.
use the setter and you'll be fine
 
5:34 PM
Ok...Sorrry :) ...Ok getters and setters right?
http://ejohn.org/blog/javascript-getters-and-setters/

Ok
@Matt:Really sorry
:P
It is not cross browser?
 
user1385191
ignore resig whenever he speaks about JS
 
user1385191
the pattern I gave you works everywhere unless otherwise noted
 
user1385191
it's a core fundamental of Object-oriented Programming
 
ok..
 
@MattMcDonald 'round these here parts we call that that there fancy method a mutator.
 
5:53 PM
cough your code?
 
@MattMcDonald that's the most useless code ever
@MattMcDonald butthurt
 
user1385191
it's useless because there's no condition
 
John resig's articles about JS aren't stupid
 
Yeah I have to agree, resig's got some fairly decent articles despite jQuery being what it is.
 
6:10 PM
I'd appreciate some upvote love for: http://forum.jquery.com/topic/diving-into-checkboxes
It's an un-optimized but robust checkbox widget for jQuery UI. I'm trying to get a better proposal solidified than they currently have.
 
user1385191
what's the purpose exactly?
 
user1385191
it seems like an overcomplication
 
There are actually a lot of cases to consider with checkboxes.
Perhaps some of it can be simplified.
 
Need some help with a nessy bug
 
user1385191
what do you hope to accomplish?
 
6:14 PM
and this works jsfiddle.net/BPpmT
in chrome anyway
but in my application this line: document.getSelection().addRange(range);​ gives me Uncaught SyntaxError: Unexpected token ILLEGAL
 
@MattMcDonald The idea is to get a good checkbox widget instead of the lousy button one they have. See morrisonlevi.github.com/jQuery-UI-Theme (latest changes haven't quite pushed yet, but you'll get the idea)
 
user1385191
moving the checkbox on change is a bad idea
 
@MattMcDonald Explain? I don't 'move' anything so you'll have to explain what you mean by that and why it is a bad idea.
 
user1385191
you lose consistency
 
user1385191
buttons that move around annoy users
 
user1385191
6:17 PM
when it's "selected", the radio/checkbox is on the right
 
user1385191
when not, it's on the left
 
Oh, you mean it should just change color/icon? I disagree on that, but it has nothing to do with the JS. It's just an image.
 
@LeviMorrison seriously? Check boxes ._.
 
user1385191
at least you're using form elements instead of divs and spans
 
It's called <input type="checkbox" />
 
user1385191
6:22 PM
that's probably one of my biggest pet peeves
 
user1385191
div "buttons"
 
Drives me nuts as well. Using the <label> actually does some behavior things for me, so it's a double win.
 
What the hell? I come back and have 20 chat flags!?
 
@OctavianDamiean someone flagged all your messages?
 
No no, random people flag random messages.
At least it looks random to me.
It probably isn't.
I don't care.
 
6:33 PM
Plot it on a map, the killer might have a pattern.
 
wanders off to look for his whiteboard markers
I should ask Charlie Eppes to help me compute who the killer is.
I'm sure he can do that with some amazing computation model.
 
what do these look like to you guys?
totally sfw
just some pixel art
 
Is the :first-letter selector valid only for p elemnts?
 
Like color splashes.
 
think old school retro
:?
damn
guess I need to do some more :P
they are supposed to be procedural pixel animal heads
 
Zoom in a bit. :)
 
If I used jQuery's .click event to make a div appear, how can I make it disappear when the user clicks on something else?
Without adding an event for each div
Is it possible?
 
<speculation> couldn't you add an event to document and hide when its clicked? </speculation>
 
document.body.onclick = function(){yourdiv.style.display = "none;"} ?
 
6:42 PM
@JoeyMorani Stop.
 
@Incognito Stop?
 
@JoeyMorani That doesn't make any sense. Explain to me what a .click does.
 
oh shi..
prob could use focus eh? though I dont think divs can receive focus
 
How it works?
 
ah, @Incognito rants. love 'em.
 
6:43 PM
Trying to teach me a lesson? :P
 
@ThomasShields "I swear I don't rant." - classic rant.
 
Life's a lesson. ;)
 
@JoeyMorani Yes. I teach through asking.
People hate it.
 
Okay. Let me guess :P
 
It's an awesome way of teaching.
 
6:44 PM
Looks like it's just a short-cut for the code above ^
.onclick
Instead of writing all that
 
why do we use .onclick instead of .click then?
 
Because...
Erm
Something about DOM ?
Erm
 
Nope.
.click doesn't exist in the dom, actually. .onclick does.
 
any idea why you wanted to use .click, then?
 
6:46 PM
@JoeyMorani So .click binds an event to an element, explain that to me.
 
Hi, can somebody tell me why SO uses Google Code Prettify whilst it being unupdated for almost an year now?
 
the answer is in your question :-)
 
@badlearner Ask meta.
 
Dis progammz world iz vey vey confuzin' ...
 
Good idea... thanks
 
6:47 PM
Ermm... sweats nervously
 
guys I just wanted to say I love jquery
 
@badlearner Because it works?
 
Please tell me though.
 
.click is a method provided by jQuery that allows you to do the same as .onclick
 
6:48 PM
I don't have a clue
 
man.. if I could put on my pants with $('pants').putOn() id be in heaven.
 
0
Q: how to choose a web framework and javascript library?

TrylksI've been procrastinating learning some framework for web apps w/ some library for AJAX, something like django with prototype, or turbogears with mootools, or zeta components with dojo, grok, jquery, symfony... The point is to spend some of my spare time, have "fun" and create cool stuff that hop...

 
Lmao
 
about @Incognito's question, I'd suggest you ask google :-)
 
@OctavianDamiean lol, it's got many issues with identifying languages alone
 
6:48 PM
is being random too much caffeine sry
 
@Loktar: explain? :p
 
.click() only attaches to a jQuery wrapper thingy, right?
 
any ongoing development could have helped that a lot
 
@badlearner Well, just use the manual language selection then.
 
@JoeyMorani Stop freaking out. Once you know how much you don't know and are comfortable with that you'll be better able to learn.
 
6:49 PM
<!-- language: lang-js --> for example
 
it's almost alive! rlemon.com/projects/snake
 
aww snap @rlemon
nice man
 
@JoeyMorani What a .click() does is bind a new event listener to an element. Every time something happens to that it calls that function.
 
Ah. So what's the point of .click if you can use .onclick ?
 
@JoeyMorani .click on the same element adds yet another new listener, so you just keep adding them, they don't over-ride.
 
6:50 PM
@OctavianDamiean Okay... the syntax highlighting is still done by Google Code Prettify right?
 
@JoeyMorani .click() is jquery's way to doing thing, it attempts to abstract .onclick from you.
You should spend some time reading this javascript.info/tutorial/events
 
What's the point if .onclick works fine?
 
@JoeyMorani: remember that jQuery is just a library written in JS though, that it abstracts away some DOM inconcistencies, but once you know your way around you can handle most of them. jQuery is a performance bitch though. Bitch in the way that $('#id') is ten times slower than document.getElementById('id') (or By.id('id') if you use a very small object to write less characters)
 
@Loktar It would be more like $('pants').putOnLeftLeg().putOnRightLeg().pullUpZipper().aQuadruzillionMoreCall‌​s();
 
@JoeyMorani Because someone didn't like writing .onclick, they felt $(something).click(function(){lolwhat}) was easier.
 
6:51 PM
@OctavianDamiean lol not to mention it would have to load the WHOLE closet :P
 
You can write your own, all you have to do is:
 
@badlearner Yea, what is the problem now? Automatic language detection or what?
 
var flibbityFloop = function(element, callback){ element.onclick = callback };
Then flibbityFloop(SomeElement, function(){lol now I'm jquery}).
 
is adding a custom property to event (for use in bubbling) a bad idea?
 
jQuery is an abstraction contraption that makes stacks lack compaction and you won't know what happened because it is a fools distraction.
muahahaha
 
6:52 PM
Ahh. xD
Okay. I get it.
.click() seems pointless.
 
@Loktar Exactly, actually to make sure the pants fit on your neighbors ass too (just in case he steals it or something) it has to load the entire closet in all possible sizes.
 
haha
 
@JoeyMorani I applaud your lack of "ur stupid jQuery's awesome trollololol"
 
@JoeyMorani It's just the "jQuery way" it's nothing special.
 
hmmm
I can't see how jquery handles the click method in the source though
 
6:54 PM
@FlorianMargaine Where are you trying to find it? 1.7.2 just came out.
 
I guess it's thanks to this function : jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +...
 
After I've developed the thing I'm working on I'm going to attempt re-writing it without jQuery.
 
John Resig must love this room.
 
oh thanks
@Loktar: great one!!
 
user1385191
6:55 PM
@OctavianDamiean he ignores criticism
 
user1385191
see: CLJ
 
@MattMcDonald Like a boss.
 
@JoeyMorani: the reason why .click is so slow is because it gets through many functions before actually setting the event listener
 
@MattMcDonald He's always ignored all criticism. These issues were brought up when he sandwiched together a bunch of other libraries and called it jQuery.
 
So jQuery is slow because it loads unnecessary code?
Code that might not be used.
 
6:56 PM
@JoeyMorani That's a big part of it.
Not the only reason, but a big reason.
 
jQuery is also slow because it abstracts pure js
 
And attempts to do browser compliance.
 
Ah, okay.
 
it's just that it wants to try to be ultra generic, so it needs to pass through many many checks before actually getting the stuff done, without taking care of special cases like click that works fine in every browser
 
like playing a video game using someone elses hands to control the gamepad :P
 
6:58 PM
Seriously wtf!? $.attr.
 
user1385191
@Incognito he made one infantile response on CLJ and then declared it unfit for the JS community to read
 
@MattMcDonald Eh?
 
GGG
@Loktar randomly generated?
 
yeah
working on bodies now
 

« first day (523 days earlier)      last day (4440 days later) »