« first day (24 days earlier)      last day (4931 days later) » 

10:00 PM
@AndyE @NickCraver Please pin chat.stackexchange.com/transcript/message/19697#19697, or whatever message you could find of @rchern or myself introducing the userscript. Thanks!
@rchern @TimStone ... And that's how you do it ;)
 
@YiJiang We like to leave the dirty work to the professionals ;)
 
done
 
Awesome :)
One step closer to chat domination..
 
@NickCraver Erm... maybe pin a message of @rchern introducing the script in this room instead of a link to another chatroom transcript
 
link me
doing 10 things at once, and just got back from a vet appt
 
10:03 PM
Okay, wait, leeme reproduce that message here
 
awww, you don't want to let @rchern reproduce it? :p tehehe
 
@rchern - can you post the same message in here so we can star/pin?
that short/concise format that fits on the right was perfect
 
Keyboard shortcuts and IRC-like /commands for chat: Install Link and Github site
12
There @NickCraver
 
and starred
and now I can't unstar the other one ... :|
 
hmm, is there any remarkable difference between using .textContent or .innerHTML to "fill" a dynamic created script element ?
 
10:13 PM
.innerHTML may strip...whatever it wants
it's less specifically defined and implementation specific
 
does textContent mark it as CDATA?
 
so you're saying .textContent is cross browser ?
 
mmm nope
but where it is, it's consistent
sorry, reinstalling sql 2008 r2 here, someone failed to do it correctly
 
what about scr.textContent = scr.innerHTML = 'something;';
 
Cool, chatting via iPad here, works fine
 
10:19 PM
looks like it won't get double evaluated
 
hehehe sorry, was on the phone
thanks for the pin @NickCraver, @YiJiang
 
reading the spec it sounds like setting textContent will destroy the contents of the node and replace it with whatever you set it to. So doing both will just undo the effect of setting .innerHTML
 
in Chat feedback, 1 min ago, by Nakilon
The message "(Ruby Inside Feed)" was mine, but it has been linked to Feed-bot's messages.
 
I personally use .textContent in Chrome for user scripts, if that's what you're after
 
i'd go with textContent, because it sounds like it marks it as character data, and hopefully won't start trying to interpret things like & as weird symbols (  style)
 
10:21 PM
See, it wasn't the userscript :P
 
@david: regardless of the order from those assignments ?
 
I don't know about order, if .innerHTML DIDN'T overwrite the textContent then you'd end up with your script duplicated...
 
hm, now I'd really like to know which browsers support .textContent
mr. google, do me a favour please
 
Google: Sorry jAndy, Mr. Craver was faster
 
10:25 PM
so basically everything except IE8 and below
 
@TimStone huh?
 
@rchern His message appeared inside the wrong monologue, but he's not using our userscript.
 
I guess IE7+8 is worth checking for it and falling back to innerHTML then
 
@NickCraver so ie doesn't support textContent, but uses innerText instead
just do if(node.textContent) {/*use textContent*/} else {/*use innerText*/}
 
I could be wrong, but .innerText was never part of the spec iirc
at least I don't remember seeing it in any DOM level
 
10:28 PM
probably not, but that never stopped IE before
 
true
 
innerText was never part of the DOM. FWIW, Chrome supports innerText. Also, textContent and innerText differ on certain things (like white-space)
 
.innerText does not seem to work on style elements (Fox)
and for script tags Firefox won't do much either
so it should be if( node.textContent ) {/* use textContent */} else { /* use .innerHTML /* }
but then again, it's completly fine if the IE's perform fine with innerText. Can somebody confirm that? I don't have an IE here atm
 
Is there any chance you could get this script that you're trying to run served as text/javascript from your server so you can just put it as the src of the script tag?
 
10:43 PM
ahaha right, so that would defeat the entire purpose
 
I'm so interested in it because I just wrote a little script loader which uses exactly that, but for now with innerHTML. Wasn't aware of textContent
 
@jAndy I often define which I need beforehand and store it in a variable
var t = "textContent" in document.body ? "textContent" : "innerText";
alert(element[t]);
Like I said, though, differing white-space.
 
@AndyE: I will definetly pull that into my init scripts aswell now. But I still don't know if .innerText works on IE6,7,8` :p
 
@jAndy: AFAIK, Microsoft "invented" innerText, it's supported at least as far back as 5.5
 
according to the link nick posted it is supported from 5.5 onwards
only firefox doesn't support it
 
10:48 PM
@AndyE: ok, but script and style tags still might be treated differently. Woa I really have to boot a windows machine now
@david: 'only'
 
@jAndy: with script tags, you need to use .text in IE.
Differing white-space example (view in Chrome): jsfiddle.net/AndyE/YQfAW
 
@AndyE: can you give an example where .innerHTML will fail on this purpose? since it seems to work well cross-browser (at least, technically)
the purpose is, to load javascript or stylesheets by filling the script or style tag with innerHTML
 
@jAndy: innerHTML will return entity-encoded text from nodes. So < becomes &lt;, etc
 
@AndyE: I'm loading quite a lot of scripts with using it that way, no breaks so far
for instance, for(var i = 0; i < 100; i++); should fail if you were right
 
just out of curiousity what's the idea behind innerText? strips tags? How is that different from .innerHTML?
 
11:02 PM
should encode them, but again, it's non-standard
e.g. .innerHTML = "<span></span>"; gets you a <span> element
 
innerHTML is part of HTML5
 
.innerText = "<span></span>"; should get you &lt;span....
@AndyE - he was asking about innerText :)
 
rubs eyes sorry :-)
 
installing sql server's boooooooring
 
@jAndy it's possible innerHTML works differently for scripts - they are intended to be CDATA, after all.
 
11:04 PM
at least your configure the data directories during install in 2008+
 
@NickCraver it's all good ;)
 
@AndyE: looks like it
so far all browser just perform fine
 
@jAndy: I think I chose the wrong word when I said "differently". Script elements don't contain HTML, so nothing should be encoded when fetching the contents via innerHTML
 
so why doing all the hassle in checking for textContent or innerText as a browser switch.. for that case it looks pretty much crossbrowser compatible
 
@jAndy: yep, using innerHTML should be fine on script tags.
and style elements
and anything else that should have CDATA as its content
 
11:09 PM
@AndyE: I thought so, until this discussion here started :p still have to check some IE's before I can sleep well
 
0
A: Styling input with jquery

brendanYour selector is not valid Try jQuery("input[name='latLng']) Or jQuery("#latLng2")

....am I missing something there?
 
@NickCraver: yes, a lobotomy.
 
pre-frontal?
 
That should do it, alright
Only then will you be able to answer questions to that standard.
 
the selector...I didn't follow that answer thought maybe I'm missing the obvious
there was a scary one yesterday, started off $(window.location).attr('href',....)
 
11:14 PM
#latLng2 would be quicker though.
@NickCraver lol interesting. Does it work?
 
not correct tho IMO
if there's a #latLng2....
 
yeah, it's not the same.
 
nah it was completely wrong, the person was trying to use delay to set a string on the window.location object
let me find it
 
ahh I think I saw it, actually
 
0
Q: jquery: delay() + window.location ?

lauthiamkokHi, I know that we can delay the url redirection easily with plain javascirpt below, setTimeout(function(){ document.location = 'http://stackoverflow.com/';}, 2000 ); what if I want to use jquery's delay()? $(window.location).delay(4000).attr('href', 'http://stackoverflow.com/');// fail to...

 
11:16 PM
yeah, I did see it, just didn't read it very thoroughly
I even +1'd you
 
don't!
or get a paper towel, for the nosebleed
if you do choose to read all the way through it
 
@AndyE: IE6,7,8 screw up on innerHTML, but as you mentioned, work fine with .text. The funny part is that the latest official release of chrome, firefox and safari also work fine on .text
I feel a little teased
 
@jAndy: frankly I was surprised when you said it worked in the other browsers.
 
now the question is will a pattern like scripttag.text = scripttag.innerHTML = "something;" get double evaluated somewhere
 
@jAndy, why not just use text/textContent ?
 
11:25 PM
@AndyE: yes right, also pretty reasonable, but the same question. Guess I have to do some testing here
 
just curious, why are you putting text in script elements anyway?
 
What is the best way to get an 'associative array' functionality in javascript? does Object[key] = value have issues if the key is a reserved word?
 
var obj = {}
 
@NickCraver: that is just an option of my multipart xhr script loader. scripts gets either eval'ed (using native eval obv) or are inserted into the dom by script tag insertion which then puts the javascript code into those
 
obj["function"] = value works, doesn't matter if it's reserved
 
11:29 PM
@NickCraver: the reason for that is, this technique is faster on some browsers than calling eval. Sounds pretty wierd I know, but seems to be true
 
@jAndy why not always eval, since that's what's happening anyway?
 
@jAndy: don't forget, eval() executes in the current scope.
 
eval() may have something to do with the fact that eval() has a return value.
 
might want to glance there, the way jQuery implements $.globalEval() has no issues I'm aware of
 
11:31 PM
@NickCraver can't you also do obj[othervar] = value ? (presuming othervar is a string)
 
corresponding support check for IE:
@drachenstern yup
 
for that matter, does othervar have to be a string?
 
@NickCraver Wonder why it doesn't just use execScript in IE.
 
@AndyE - security constraints based on global policies iirc
 
@drachenstern Property names must be strings.
 
11:32 PM
@drachenstern no, it doesn't toString() is called.
 
@NickCraver: yea seems almost the same way I'm doing it now. but instead of using appendChild I use textContents I guess
 
@AndyE quoting the mozilla doc
 
someone motivate me to do iframe/js testing
i'm having trouble mustering up any enthusiasm for it
 
@rchern the world is coming to an end, you must work on the iframe testing ...
no wait, that doesn't work
ummmm
 
@rchern That's because it's pure evil. You should do it anyway, though, so you have time to pull my commits later. ;)
 
11:33 PM
@drachenstern: the value passed is converted to a string using its toString method.
 
but then again I'm wondering, why is Resig using appendChild there.. doh
 
@AndyE if it's convertible ... I was thinking if you used an (I know, bear with me) associative array as the key
 
@TimStone hehe
 
@drachenstern: I don't follow... :-P
 
because that would be fun, to use obj[ { "myVal" : "myGUID" } ] as a lookup ... :p
 
11:35 PM
 
where myval and myguid were placeholders for whatever
idk, just thinking about a purely evil way to do associative arrays in js
 
@drachenstern: the resulting key would be "[object Object]"
 
@AndyE yeah which kills what I wanted
 
@drachenstern you could do that if you overwrote the toString method.
 
@david but it wouldn't be an object in the key position
I was looking to have the object there, not just a string
and not just a string representation
 
11:37 PM
@rchern - there are delicious smores inside the iframes
 
haha
 
@rchern I heard they're giving away free iPads to whoever gets it to work
 
I wish!
 
obj[{}] = "bob";
 
does parent.location.reload() work cross-domain?
 
11:39 PM
@NickCraver isn't that equiv to obj["[object Object]"].value = "bob";?
 
doing cross-domain testing is a pain, sigh
 
yup
no, it doesn't, parent.location will throw access denied
 
Tek
that's what my parents said when I told them I got evicted :(
 
top.location.reload() ?
 
hah
negative
any frame on another domain is going to throw access denied on .location
privacy issue even seeing the page it's on
 
11:41 PM
Hmm, I thought that's what the break-out-of-iframe code was like.
(ie, using top.location)
 
0
A: Passing value to result with jQuery

Andy ELike most of jQuery's getter overloads, val() returns only the first item's value. You could use map() and join the resulting array: $(function() { var value = $('input:radio:checked').map(function() { return this.value; }).get().join(" "); // You could join with a comma if you...

^ down voting without saying anything is bad form
I guess it could have been the OP...
 
if (top != self) {
    top.location.replace(document.location);
    alert("For security reasons, framing is not allowed; click OK to remove the frames.")
}
so sayeth SO
 
that code isn't getting the location
not where you can use it for anything
 
I don't want the location, I just want the parent page to reload
grumbles, hrmph.
seems weird that top.location.replace is ok but top.location.reload isn't
 
replace doesnt do anything - it just returns a modified string
 
11:47 PM
@drachenstern Here we go, using objects as associative array keys through overloaded toString methods >.> jsfiddle.net/ctrlfrk/TmSaP
 
actually im wrong o_O
that is weird
 
@rchern The end behaviour is different though I think?
 
@david you're missing my point or I'm not explaining myself well enough
 
you want to use anonymous objects?
 
@TimStone hm?
 
11:49 PM
What if I wanted to obj[ $(sel).data() ] = [ $(sel2).data(), $(sel4).data() ]; ... yes, I could serialize the data out, but that's no fun
 
@rchern Reloading the page could technically resubmit a POST request (hypothetically speaking), which replacing the location could never do, right?
 
anyways, it's an academic debate, I would never want to use not-strings, but I know people abuse javascript all the time
 
it'd be nice if they didn't have to hard-code my url (the parent page url) in their code...
 
Yeah i'm trying to abuse it now. Wondering if there is a way to override the base Object.toString method to return a unique string per object created >.>
 
so in other words, a .getHash() type function?
 
11:52 PM
@rchern It'd be nice if they didn't make such a silly setup too, heheh. :P But yeah, hrm.
 
let's see if @NickCraver is faster than google: "does javascript have a native tohash?"
 
@TimStone hahahaha
 
oh that's a crap query because of the address bar
stupid # is called hash
 
yup
 
well, its proper name is url fragment.
 
11:53 PM
@NickCarver query: exists a proper javascript gethashcode ?
 
@rchern And top.location.replace(top.location) gets angry right?
 
anywho, that's it from me. Peace out :-P
 
night @AndyE
oh sure, .NET Object.GetHashCode() calls back to internal static extern int InternalGetHashCode(object obj);
 
@TimStone, that's what I'm testing now (:
hmm, actually, there may be a quicker way to test this
 
11:59 PM
@rchern Yeah, I was going to throw it on my test server...but then I realized it wasn't on, so... shames ;)
 

« first day (24 days earlier)      last day (4931 days later) »