« first day (586 days earlier)      last day (4585 days later) » 

17:00
!!> "john-resig".split("-").map(function(v){return v.charAt(0).toUpperCase() + v.substr(1);}).join(", ");
@Esailija "John, Resig"
@OscarJara the community has spoken. your answer is not only invalid... but bad advice... i'll let the downvotes kill it out of existence. — rlemon 31 secs ago
lol
i'm not even going to argue with him.
the answer has been downvoted to death.
you are voted off the island
0
Q: Do we have to adhere to legacy browsers for answers to questions?

amanaP lanaC A nalP A naM AThere is a debate going on the the comments here about support of certain javascript features in legacy browsers. Do we have to give an answer that adhere's to all legacy browsers? Because if that is so, I know many many answers that do not give a solution for IE 1.0...

edit that question fit in with it all...
jqon - jquery object notation , Since JSON was in the process of getting consistent and was incredbily fast , John Resig came out with yet another blockbuster of the century ! jqon - this is a native jquery object notation saves your objects as arrays 10x of there size and kills your small json parser (which is this built on the top of ) by 100x workload to parse really heavy dom mimicing and incredibly awesome objects!
17:08
given any answer, MattMcDonald will find a legacy browser that the answer won't work on
3
LMAO
no no no @Abhishek
did you know that innerHTML doesn't work in tables on IE?
well yes, that's an easy one
:p
that surprised me when I learned it tho
$.jqon = function(string) {
     for( var i = 0; i < 9e+9; i++) {
          // do nothing... important...
     }
     return JSON.parse(string);
};
17:11
@rlemon is it "it's important to do nothing" or "do nothing that's important" ?
both
it's jQuery
...
jquery's bashing is annoying :(
did you know that IE can't handle leading or trailing whitespace
		// Make sure leading/trailing whitespace is removed (IE can't handle it)
		data = jQuery.trim( data );
or that
// IE doesn't match non-breaking spaces with \s
lol do you just search "IE" in jquery source code?
yes
288 matches
17:14
@rlemon I love your "unicorn starring" script :D
// IE strips leading whitespace when .innerHTML is used
// IE will insert them into empty tables
// This requires a wrapper element in IE
// (IE uses .cssText instead)
// (IE normalizes it by default)
// (IE uses filter instead)
// (IE uses styleFloat instead of cssFloat)
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
// Cloning a node shouldn't copy over any
this is after first 20% of jQuery source
it's impossible for anyone to remember these
> // (IE uses .cssText instead)
other don't?
others use getAttribute("style") it seems
in chrome cssText works though
as well as .innerText
... they use cssText too iirc
as well as outerHTML
firefox doesn't have outerHTML nor innerText but has cssText
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
ok this is just wtf
	removeProp: function( name ) {
		name = jQuery.propFix[ name ] || name;
		return this.each(function() {
			// try/catch handles cases where IE balks (such as removing a property on window)
			try {
				this[ name ] = undefined;
				delete this[ name ];
			} catch( e ) {}
		});
	}
btw in that question he is using jQuery
is nobody aware that jQuery has parseJSON
17:27
@Esailija isn't that available only as plugin?
i use parseJSON from json.org/json2.js
Or am I confusing parse with stringify?
no, it's built-in
not found? sorry, i didn't check it
Then I'm confusing it with stringifier.
17:29
yeah jQuery doesn't have it, it's much less common to use and a lot of code
you typically send plain old form data to server and get json data back
i used this plugin code.google.com/p/jquery-json just for toJSON, because JSON.stringfy made string was giving format error when received at server
lol, I just make sure i'm using well formed JSON :P but i'm crazy like that
LOL I didn't read the url
I tried like 8 combinations before realizing
LOL
@FlorianMargaine the issue is not getting D3 to run in WINE... but to get D3 to install in WINE on a 64 bit system
there is no WINE 64 bit
17:38
@jjpd what do you mean format error?
why are you using a 64bits system?
and to patch the 32 bit version on a 64 bit machine requires you to build form source... which you cannot do (build a 32 bit version on a 64 bit machine) without changing around a buncha crap and borking and chance of ever building a nother 64 bit program from source.
@FlorianMargaine because at home i'm running i5 2500k - I will not be suckered into running 32bit os
!!> JSON.stringify( {"it works": "Just fine.", "thank": "you"} );
@Esailija SyntaxError: Unexpected token ILLEGAL
@Esailija "{"it works":"Just fine.","thank":"you"}"
17:40
@FlorianMargaine your argument hold no grounds... "why are you using the faster, better, version of the OS that was designed to run on your hardware"
umm, because it makes sense!
yes :P
32bits kernels can run 64bits proc with no problem whatsoever
you know, the pae kernels...
ugh. you are missing the point.
my home pc was not a gaming pc. until d3
if i'm going to be hacking about just to get it working on the 64bit system then eff that
!!> Array(10).join(+"a") + " Batman! (your snippet rocks, @Esailija)"
17:42
and if i have to downgrade to the 32 bit version then eff that
@FlorianMargaine "NaNNaNNaNNaNNaNNaNNaNNaNNaN Batman! (your snippet rocks, @Esailija)"
windows 7 64 bit runs it fine.
@FlorianMargaine the real solution is "WINE, Y U NO MAKE 64 BIT WINE?!?!?!?!?! ITS 2012!!!!"
Hi guys, I want to turn selected text into h1, I do it with execcommand('heading',false,'h1') and it works fine in chrome and ff, but not in ie9... Does anyone know how to do this in ie9?
17:44
!!> "AJAX".replace( /ajax/gi, "xhr" );
@Esailija "xhr"
wtf execcommand?
yeah, document.execCommand
heading
Adds a heading tag around a selection or insertion point line. Requires the tag-name string to be passed in as a value argument (i.e. "H1", "H6"). (Not supported by Internet Explorer.)
@Oleg i know what was the problem , which let everytime new russian website attached to my website
@Esailija So is there no other way to do this in ie? I don't want to wrap the contents in a h1 element coz it's difficult to then remove it again
@gosto tell me about it
17:51
use an already made rich text editor
or selection apis
@Oleg i have read that there is viruses in java , and they use java , so i disinstalled java and intalled the new version (7) and this websites are gone , it means i had virus attached , and what i explain about you . that you also had this virus attached , so maybe you also have this virus in your java or !!
@Esailija :( Noooooo.... I want to build my own as a project, otherwise I would've settled for tinymce or ckeditor. Is there really no way to do that in ie?
yes, by not using the shitty execCommand API
@gosto >_> it was your instance of java fetching the site, not mine.
Hahahaha, oh ok, please can you show me how to do it then?
17:54
@Oleg i had one file using java , when i disable it from publishing this russian website disapear , and when i enable it this russian virus comes again
:3840220
function wrapSelected(tag) {
    var range,
        selection = window.getSelection();
    if (selection.rangeCount > 0) {
        range = selection.getRangeAt(0);
        range.surroundContents(document.createElement(tag));
        return true;
    }
    return false;
}
^ not cross compat
but can be made so.
@Oleg u have latest version of java ?
@gosto I don't have java installed.
@Oleg so u mean the virus is in website not in java ?
@rlemon If I want to remove the tag againg it;s going to be impossible
17:56
@gosto yep
@Stuyvenstein how? it's now in the DOM.
@rlemon WOW
0
A: Do we have to adhere to legacy browsers for answers to questions?

Oscar JaraDo we have to give an answer that adheres to all legacy browsers? I don't think that "all" but try to do it (in my opinion). We don't know the situation of the OP , maybe he/she is dealing with a not common situation (I won't imagine all possible situations because there are a lot). If you read...

@Oleg but how can you explain this ? when i updated java this virus gone !!
@gosto I have no idea. I'm not a java developer.
17:58
omg chrome 38%
last time I checked it was 10% or so
Has anyone tried the chromebooks?
@Esailija where u getting ur stats?
oh w3schools
Where's teresko?
@Esailija oy... use: gs.statcounter.com
17:59
He's gonna put you through so much pain.
And downvote you to oblivion.
@Oleg no , i mean when i updated java and the virus gone means that virus was in java , and in other way the virus in my website when you opened it , so i dont know where is the virus really :) . now i have no virus attached , can you look if you fine this russian website script attached?
lol, now i'm just being a jerk... But I cannot validate any information coming from w3schools. — rlemon 16 secs ago
fuck you, only 31%
I was happy wiht information from w3schoools being 38% :)
@Esailija schhht let your mouth sweet
@rlemon If I want to remove the h1 tag again, I'll have to search for it right? If there are multiple h1 tags it's a problem
18:01
holy shit how can w3schools have 19% on internet explorer
it should be close to 0% :D
since "developers" go there
I wonder how many have IE in MDN
@Esailija maybe they are affected by gs.statcounter.com/faq#prerendering
Whats wrong with deletegate function in jquery version 1.4.4
jQuery(document).delegate('.dropDown li','click',{ name: "Addy" },function(e){
this is not triggering click event
@gowri Why are you using delegate?
"As of jQuery 1.7, .delegate() has been superseded by the .on() method."
my version is 1.4.4
So... what does the console say?
18:10
@Stuyvenstein jsfiddle.net/rlemon/h8ghY/2 you can just return the range... then grab the common ancestor... then parse that.
@Oleg: not logging any errors
@Oleg where are you reading that? Only live has been deprecatd
So... it could probably mean that the selector has found nothing. What's your html structure?
@gowri jsfiddle.net/rlemon/u8uKf Looks like it's working for me!
18:12
Looks like it's working for me!
Just after the grey area.
omg no
.delegate/.bind api is much better than .on
fuck you jQuery
$(document).delegate(selector, events, data, handler); // jQuery 1.4.3+
@gowri Make a fiddle.
sure
18:13
jsfiddle.net/rlemon/u8uKf/1 jesus am I invisible
!!> "http://jsfiddle.net/rlemon/u8uKf/1/"
@rlemon "http://jsfiddle.net/rlemon/u8uKf/1/"
thankyou
someone noticed me
@rlemon If I hit enter it just wraps it in another h1 tag
ohh wait.... nvm.
I know now, it should render the jsfiddle result in the chat
18:15
@Stuyvenstein yea? you want me to provide you with a total solution? well then we will need to talk about a payment plan.
i showed you how to wrap it... and how to get the newly wrapped content in a container.
HOLY SHIT IF YOU WANT TO MAKE IT YOUR OWN PROJECT THEN MAKE IT YOUR OWN PROJECT
internet explorer do it yourself
i.e., not IE
you SAID you don't want to use tinymce or ckeeditor
it can be confusing in our world.
because you want to do it yourself
BUT now you are just asking for micro instructions
18:16
???
twitter is down?
Hahaha, aaahhh I just cant get it to work in IE. Maybe I should create a function that tells ie users: "Sorry IE not supported"
not for me
18:16
uh
you guys gotta see that one
Some bastard blocked it grrrr
@Oleg: Strange
fiddle works fine
yeah I'm not gonna watch 33 min video
Blocked what ?
@Esailija but its awesome!
18:18
please summarisze
Probably misspelled class name or something.
@gowri inclusion issues? where the js lives? in the fiddle you are on load.
Esailja well its basically about writing automation and robotic codes in javascript
kinda amazing how js can be used ofr making ur home run !
automatically
it looks like jQuery to me
read the second line
18:20
@rlemon: yes its not working even onload on my dev page
but click function works
then we need more code to help you
What would be the best way to handle changing the current pages link to the "active" class when my content changes based on the current PHP $_GET variable.
heh, I did that today
something like:

$menu = array(
    array(
        'title',
        'get_variable
    ),
    // ... you get the point
);
foreach ( $menu as $key => $item ) {
    if ( $menu === $_GET[''] ) {
        $menu[ $key ] = 'active';
        break;
    }
}

foreach ( $menu as $item ) : ?>
    <li class="<?php echo $item[ 2 ]; ?>"><?php echo $item[ 0 ]; ?></li>
<?php endforeach; ?>
there's not everything, but you get the idea
well, gotta go now, cya guys
I meant using JS if possible, but I appreciate the answer.
18:28
interesting
let me see if I can write the JS $_GET script for the 3510530th time
I'm assuming I would need to use AJAX to request from active_get.php where it just echo's the GET variable and when it returns to change the class to the returned value?
is that the best way to do it?
var $_GET = document.location.search.substr(1).split("&").reduce( function(obj, value){
	value = value.split("=");
	return obj[value[0]] = value[1], obj;
}, {} );
!!> "a=1&b=2&c=3".split("&").reduce( function(obj, value){ value = value.split("=");return obj[value[0]] = value[1], obj;}, {} );
@Esailija SyntaxError: Unexpected identifier
@Esailija [object Object] {"a":"1","b":"2","c":"3"}
yay
@Event_Horizon best way to do it is server side... if you are using XHR to pull the content in .. well then... the answer is too simple to even mention .. and if you are loading the page and the uri variable contains the name of the page you are on... or you will have an array of indicies you can ref against, then again it is easy peasy
if you are using mod_rewrite to muck around the uri then there is still a solution. :P but we need more info man.
yeah this won't work if you don't actually have a normal querystring
I don't even know any pages nowadays that do
it's all clean urls
yup :)
18:37
my URI looks like this mocksite.com/index.html?action=home
i wrote a helper function for code igniter to deal with active nav links
if( ! function_exists('bs_nav_link'))
{
	function bs_nav_link($url = "", $title = "") {
		$liclass = "";
		if( is_active( trim( $url, '/' ) ) ) {
			$liclass = "class='active'";
		}
		$title = empty($title) ? ucwords( trim( $url, '/' ) ) : $title;
		$pretty = $title;
		return $html = "<li $liclass><a href='$url' title='$title'>$pretty</a></li>";
	}
}
pretty singular use case (for me :P ) but you get the idea.
!!> "mocksite.com/index.html?action=home".match( /action=([^&]+)/ )[1]
@Esailija "home"
using @Esailija's code....
If I echo out my get variable and use AJAX to request from the php, couldn't i do this
if(xmlhttp.responseText=="home")
{
document.getElementById("bhome").className=xmlhttp.responseText;
}
if your urly is really that ugly then just doing document.location.search.match( /action=([^&]+)/ )[1] works
18:39
Soooo you make a request to the server... get the page back... then make another request just to verify some shotty css rule?
Well I haven't done an AJAX request yet...
why are you using ajax?
ok ok so is the content loaded via XHR? or is the page refreshed and the content is loaded?
Because I have to be able to change the class on the already existing button
if so, set the active class server side.
ok wtf
18:41
-___-
your question makes no sense... can you give us some context.
Ok, I'm using index.php to include several html pages, one is topnav.html which just holds the nav menu, php doesn't generate it it just pulls it into the page.
well there is your issue
Have someone already used Jocys library in javascript?
Which is why I was trying to use JS to modify it since its already in page
18:44
jocy javascript
Did you mean:
join javascript
jo javascript
jce javascript
joose javascript
that doesn't work in chrome, off to a great start
the frame on the left have to be redimensioned
i had to do that..
@EventHorizon
index.php
<?php
$active = $_GET['active'];
?>
<html>

<body>
	<?php include "header.php"; ?>
</body>

</html>

header.php
function nav_link($url = "", $title = "") {
	$liclass = "";
	if( ( trim( $url, '/' ) === $active ) ) {
		$liclass = "class='active'";
	}
	$title = empty($title) ? ucwords( trim( $url, '/' ) ) : $title;
	$pretty = $title;
	return $html = "<li $liclass><a href='$url' title='$title'>$pretty</a></li>";
}
echo nav_link("/home","Go Home");
@rlemon Thanks, will test
18:48
that wont work as is, i dont think. but it should give you an idea.
Noone know about Jocys javascript library ? :(
if you include one php file from another... and variables defined becomes available to the latter files included.
@Andredseixas i would off used jQuery over C#.net mockup in js
System.Bool.Parse(value)
idk why i just dont like the sound of it :-|
18:49
so you create a controller / router and just load your views... in the common header file you check the current 'active' page and generate your links accordingly.
sounds SilverLightish
System.Bool.Parse = function (value) {
    /// <summary>
    ///
    /// </summary>
    /// <returns type="Boolean"></returns>
    var results = new String(value).toLowerCase();
    if (results == "true" || results == "1" || results == "-1" || results == "on" || results == "yes") {
        results = true;
    } else {
        results = false;
    }
    return results;
}
WTFJOCYS
@Abhishek I need to crypt some stuff over the way the c# library from Rijndael does...
18:51
so "1" and "-1" is true but "2" or "3" is false
@Andredseixas i dont get a single word .. please speak english
wow @jocys.com
why would you use that library unless you created it yourself
FacePalm @ jocys.com
@Esailija to be called a real programmer 8-) lol
Apparently, insertBefore is useless from the cross-browser perspective if the reference node can be null.
18:53
Ok, so no one know how to help me. If I'm using this library, is because I need. I'll solve it myself --'
if reference node is null isn't that same as appendChild
@Esailija for good browsers yes
so why wouldn't you just appendChild then
efforts man
so many efforts to make a website unbookmarkable clap
18:55
Because semantically I'm inserting before.
The fact that the element can appear last is a side-effect.
I mean why are you using that method if you don't even have a reference element
I do have it.
so if you have it, what's the problem ^^
It's just that sometimes it could be null.
In the case where the user is inserting it at the end of the element list.
what user
18:58
Arbitrary John Doe :)
you are concerned about your users opening a console on your website and running bad code?
I just wanted to share the issue that IE doesn't behave in the same way regarding insertBefore.
I see :P I would have never noticed it otherwise cos I wouldn't use that method without reference element in the first place
No. I have an API that has an .move(from, to) method.

« first day (586 days earlier)      last day (4585 days later) »