« first day (1337 days earlier)      last day (3606 days later) » 

7:00 AM
> Without JavaScript, web pages would be static
^isn't this plain false?
 
I hate when sites don't let you use +s
 
@AwalGarg it wasn't until CSS3
or rather until :hover was introduced to CSS
 
@JanDvorak I guess, CSS is not even required... HTML4.01 had marquee
 
I'm pretty sure :hover is older than I am
Well not even close
But it feels like it
I remember marquees from neopets
 
@AwalGarg ... and blink
 
7:01 AM
They were cool
 
blink lol
 
both are absolutely horrible
 
@JanDvorak they are more funny and kiddish than horrible
 
@Meredith but is it older than javascript?
 
blink is a good receipt to make horrible website
 
7:03 AM
Man I remember making backgrounds for people on neopets in like 5th grade
 
alright, Jan, sorry for going out of topic... I tried the MDN regexp thing, I didn't see anything that can help me in a practical waay...
 
<body background=url-to-image-i-stole-from-google-images>
regex doesnt help in a practical way
 
After reading the first page of the javascript tutorial on w3resource - I'm not at all convinced that they are someone else than w3schools
@Meredith don't use regex for that
 
Oh see, on learn.jquery.com... I got a point where I normally fail to understand.. I will quote it
 
document.body.style.backgroundUrl or similar
 
7:04 AM
>button.addEventListener( "click", function( ev ) {
 
Man I remember making backgrounds for people on neopets in like 5th grade
 
^ see, why do we need to pass the "ev" argument in there?
 
@AwalGarg you don't. You get ev from the caller.
 
That's another thing that bothers me
Call the parameter "event"
 
what is caller?
 
7:05 AM
Not "e", not "ev", "event"
spell out your damn variables
 
@Meredith You can name it whatever you like
 
document.querySelector( "button" ); <-- what the hell is this? I use getElementById and things...
 
You can call it wutangclan if you want
But call it what it is
 
@AwalGarg caller = the function that calls your function. Say, the native code of the browser.
 
and such new things, they drive me crazy, and I can't understand a single thing. Can you tell me what to do?
 
7:07 AM
document.querySelector returns all of the elements that match a pattern
document.querySelector( "button" ); returns a list of elements that are button elements
 
function(..){..} defines a new function that you can immediately give to the system and the system will call it for you eventually
 
document.querySelector( "#button" ); would be identical to document.getElementById( "button" );
I think
not sure if querySelector returns a list if there's just one
 
when I define a function with an argument, I have to pass some value to the argument, isn't it? @jan
 
Honestly idk what even happens if you have duplicate IDs
 
it returns the first
 
7:09 AM
@Meredith yeah, no need to know about a completely non-practical case
 
The browser calls that function when the element is clicked
 
@AwalGarg You pass an argument to a function when you call it. If you just define a function, the argument name is how you refer to a value that will be given to you.
 
fun hack: you can get all the elements with the same id, in jquery, with $('*#someId')
 
lol
 
@JanDvorak so, in this case, what is "ev", what is its use?
 
7:10 AM
ev = an event object
 
it can be useful to know.
@Loktar hey honey
 
o/
 
isn't it like 3am where you are?
 
2
I need to go to bed soon but meh
 
7:11 AM
@Meredith its a reserved keyword?
 
@AwalGarg it is an object that you will be given, that contains among others the element that was actually clicked and a means of cancelling the click event
 
I just woke up :D
 
haha morning then
 
mornin'
it's 9am here :-)
 
@AwalGarg No. It's a built-in class
 
7:12 AM
@JanDvorak oh ok... I get it now. But, cases like that are where I get confused and I can't learn further. How do I tackle them?
 
@AwalGarg come here :-D
 
alright bed time I guess
see you all later
 
@JanDvorak :)
 
<script language='Javascript1.8'> -- I've never heard of this until at w3res
 
Oh yeah I tried to xss their newsletter
It just accepted the input and didn't give me an error message
 
7:15 AM
@Meredith results?
 
Hold on I'm gonna try a real email
 
this.addEventListener('mousedown',click_card,false ); how to apply to the event listener to all childs of this ?
 
@WalleCyril what is this? Normally you want to attach an event listener when the page loads.
 
@JanDvorak I was learning regexps for form validation. I thought, I will define a regex for each field, and if it doesn't match it, throw an error tooltip...
 
They prefix their form names
newsName
 
7:17 AM
@AwalGarg Write me a regexp for numbers 0..65535 ;-)
 
@JanDvorak IDK how to do it :P
 
@JanDvorak wait... is that a number?
 
> One of JavaScript's greatest strengths is its simplicity
^Really?
 
@AwalGarg much simpler than other languages
 
Yeah javascript is pretty simple
 
7:18 AM
@JanDvorak this is the div, and it is actually apllied at page load because the script is at the bottom of the html
 
@AwalGarg hmm... define "simplicity". If brainfuck is simple, then no. If Ruby is simple, then that is useful.
 
@JanDvorak what I know is damn simple, and what I don't is not :P
 
@WalleCyril hint: whenever you put an event handler inside an event handler... think again.
 
@Meredith really?
at which level do you think you are on this scale? james.padolsey.com/javascript/who-maintains-your-js
 
@FlorianMargaine me is more than level 1 and less than level 2 :P
 
7:20 AM
4
 
> If javascript is disabled in the browser property ... it becomes inactive. - See more at: w3resource.com/javascript/introduction/…
You don't say?
 
I would have died if they said it becomes disabled
 
@Meredith so you could explain all those?
Knows what a bitwise operator does
Knows about primitives vs. objects, and wrapped primitives for method calling
Knows what a closure is
Knows how properties are resolved via the prototype chain
Knows the differences between prefix and postfix increment operators
Knows about variable/function-declaration hoisting
Knows the exact difference between x==null and x===null
Knows the difference between function declarations and function expressions
 
Yeah
All except like 2 of those you can explain after a year in a cs program
 
oh, maybe, I didn't do any cs degree
 
7:23 AM
In my school, they teach Borland Turbo C++!!! Oh yeah, the old 1980 compiler. I ROFled when I came to know that we will be taught that crap... I feel the same now about W3res after I hear all you people's thoughts...
 
@JanDvorak I don t get what you mean , my event listener works but only if I click the div direcly
 
"Note that external JavaScript files ... must have the extension .js" -- not true.
 
"file extensions matter" - w3resource
 
@WalleCyril are you looking for event delegation?
 
> The language attribute is used to specify the scripting language and it's version for the enclosed code. In the following example JavaScript version is 1.2. If a specific browser does not support the said JavaScript version, the code is ignored. If you do not specify a language attribute, the default behavior depends on the browser version. The language attribute is deprecated in HTML 4.01.
 
7:24 AM
how does it work ?
 
LOL
this site is a goldmine
 
w3schools 2.0
 
 <script src = "common.js">
  JavaScript statements.......
  </script>
wat
 
lmao
 
Please Google+, Like this tutorial on FaceBook, Tweet, save it as bookmark and subscribe with our Feed. Have suggestions? comment using Disqus down this page. Thanks.
 
7:25 AM
LOL
> This attribute specifies the scripting language. The scripting language is specified as a content type (e.g., "text/javascript" ). The attribute is supported by all modern browser.
 
“ Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ” – Martin Fowler
^that means, programmers at Google are fools?
 
@Meredith actually it does: create a .php with some php tags in it: run it and it works fine; now rename it to .html and the php tags get commented
 
(the "type" attribute)
 
@AwalGarg no, it means we're stupid
 
@towc I think php only runs if the file extension is .php
 
7:26 AM
> If any browser does not support the JavaScript code the alternate content placed within noscript tag is being executed.
 
they tell you about defer, but they never tell you that IE8 doesn't give a damn.
 
oh my fucking god
 
@towc why, I have heard a lot of JS experts can't read the gmail's js source properly...
 
@Meredith exactly, so in some cases extensions do matter
 
@towc unless you reconfigure your server to munch HTML files through PHP, that is
 
7:27 AM
Fair enough but it's php and we all know how php is
 
@AwalGarg the code is minified
 
I set my servers to run .aspx as .php
 
> There are two general areas in HTML document where JavaScript can be placed. First is between <head>......</head> section, another is specific location in <body>......</body> section.
hm, they're smart.
 
Are you guys joking around a bad website about javascript ?
 
so I can't place my scripts between the head and the body?
 
7:27 AM
@AwalGarg you see: those are hugely compacted versions of the original code and probably you you'd find the extended version you'd understand the code
 
yeah, php===easy_but_slow_and_useless_and_idiotic_and_crazy_and...
 
@WalleCyril seems so.
 
@towc ah, I see. I thought they deliberately obfuscate it...
 
@AwalGarg = true
 
@AwalGarg umm... I though crazy long variable names were specific to Java?
 
7:28 AM
their jsbin is a joke...
why are they embedding that?!
 
@JanDvorak thats a good thing, php===lagging_java <--simpler
 
@AwalGarg gmail and google need to be very very fast for a good experience, and if the code would have bent to easy to read probably a lot more people would have hacked it in some strange way, now they don't even bother I guess
those are just my guesses, don't take my words for absolute truth
 
In general JavaScript does not require a semi-colon at the end of a statement.
 
@towc I think, the code of SE is easy to read... is it hackable then?
 
7:30 AM
It's a well known fact that javascript quiet-bitches at you if you leave off a semicolon
 
@Meredith but the code reviewers do
 
@Meredith ?
 
Oh this @Meredith guy.
 
@Meredith unless you join two lines accidentally; then it bitches aloud.
 
After reading your answers to many questions.. you are full of hot air
and extremely over confident.
/me goes to bed for realz.
 
7:32 AM
@AwalGarg as long as it has no faults it isn't, but for such a complex structure as gmail I wouldn't be surprised to see little things that can be improved (after looking for a few years)
 
Yeah if you do like alert("foo") \n alert("foo")
Javascript won't do anything
Well I mean it won't throw an error
But it will be disappointed in you
 
I just ran that in my console
 
start a line with a left parenthesis, however, and...
 
worked perfectly fine
 
And v8 cried
 
7:33 AM
... it sees a function call
 
> In general, whitespace is not visible on the screen
youdontsay.jpg
 
a mostly semicolon-free project: github.com/Ralt/dmcmag-requirejs/tree/master/src
those were the fun days!
 
> name: ("Awal Garg"), email_hash: "b3fbef105b46f8235f182c12bfa09e5c"
^this comes from the SE page source. I hash my email address, and this doesn't come. Therefore, they salt it. Or maybe, they have a custom encryption algorithm...
 
7:36 AM
They wrap their javascript in CDATA things
 
their example of multiline comments is invalid syntax because it uses multiline string literals
@Meredith do they declare XHTML in their doctype?
 
Yeah in this example they do
I wouldn't be surprised if it's inconsistent though
 
is the page valid XHTML?
 
are you guys still reviewing the w3res site?
 
Looks valid to me
 
7:39 AM
@AwalGarg yeah...
 
Their doctype is xhtml 1.0 transitional
 
> There are lots of good tools in the market for developing web-based application like Macromedia's Dreamweaver.
wat.jpg
 
great, once my project is over, I will dump the link here... some of the world's finest code reviewers are sitting here, ready to review for the fun of it :P lol
 
@FlorianMargaine it's not. The Look&Feel on the screenshots is definitely Win7
the browser versions that they teach how to enable javascript in... WAT
 
@maxum Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
7:41 AM
They teach how to enable javascript in your browser... WAT
 
@JanDvorak the back and forward button remember me to win vista
 
I skipped windows 7 so idk for sure but it definitely resembles vista
 
They use bolding about as much as our worst askers
 
> <script type = "text/javascript" scr="jsexample.js" >
^hehe
 
@Meredith WinVista is a beta-version of Win7
and Win8 is a beta-version of Win9... or Win8.1. I'm pretty sure it will be Win9, however, so that they can cash in again.
document.write in their first javascript example??? Run away! NAO!
 
7:45 AM
JavaScript has become ubiquitous in web development. But that comes with a price. A lot of bad code. And as you know, one of the best ways to learn is to read others code, bad code leads to learning bad coding, especially for learners.
 
win 8 is a transition between 2 GUI, to prepare people for a more consistent simpler interface in win9
 
So they're basically telling you to find another place to learn javascript
 
!!s/consistent/touch-friendly/
 
@JanDvorak win 8 is a transition between 2 GUI, to prepare people for a more touch-friendly simpler interface in win9 (source)
 
because when I have a wall-sized screen, I want to touch it every day, 23/7 (one hour reserved for sleep).
 
7:48 AM
We should not use the "reserve words" like alert, var as variable name
Not that I disagree about using alert as a variable name
 
alert is a built-in function. var is a keyword.
 
But it isn't a reserved word
They even have a list of reserved words right there
How do you mess that up
 
@Meredith miss out some important ones, add some bogus ones
link?
 
See the example under Evaluating Variables
 
> The first character must be a UnicodeLetter, an underscore (_), dollar sign ($), or \ UnicodeEscapeSequence
really?
!!> var \newline = "\n"; \newline
 
7:53 AM
@JanDvorak "SyntaxError: illegal character"
 
Much fail. Wow.
 
print("The value of x is : " + x);
Do they not know what print does
 
I can't understand why this is not working. I made it a month ago. It didn't work, so I left it there. I have now made a fiddle of it. Can someone please check?
 
user image
2
 
@Meredith hmm... looks like the right list of keywords
 
7:56 AM
Yeah
But then they somehow call alert a keyword
 
> Another way to declare a variable is simply assigning it a value. - See more at: w3resource.com/javascript/variables-literals/…
because "use strict" doesn't exist, and who the hell needs local variables?
> Therefore var x = 12.5 and x = 12.5 are equal.
@_@
 
yep. exactly the same.
 
onemptied <-- I didn't knew this exists.. is it suitable to use it for client side data validation?
 

« first day (1337 days earlier)      last day (3606 days later) »