« first day (1482 days earlier)      last day (3481 days later) » 
00:00 - 14:0014:00 - 00:00

2:01 PM
alerts "does not have class" anytime...
 
$("#"+id) should be punishable by death
 
@JanDvorak lol why?
 
yes, why
Most of my code is that .... :(
 
@Julo0sS document.getElementById(id)
 
@JanDvorak any other way to get the jquery object then?
 
2:04 PM
ah, to avoid the jquery call I guess?
yes then :)
 
@JanDvorak yep, but now, no more jquery functions work on it... (such as .attr which fails)
 
ok... seriously... you find an element by ID (for which you don't need jQuery or string concatenation), then get its ID (which you don't need jQuery for either, if only because you already know that)???
@Julo0sS el.id
if you want to be super-pedantic: el.getAttribute("id")
!!mdn getattribute
 
To be honest, I'm on my first JS project. Everything started with jquery, and as I've gone on, things are being re-wrtten by myself in JS... Slowly realising why using javascript is a good thing and not just automtaically using jquery
but, when I was just showing some values in graphs, I never had a need. JQuery does it all, I don't think, I go home and get paid... Silly projects made me learn :(
 
<script>
        $("body").on('click','#svgCanvas',function(e){
            var posX = $(this).offset().left, posY = $(this).offset().top;
            alert((e.pageX - posX)+ ' , ' + (e.pageY - posY));
            alert("OBJECT : "+e.target.id);
            var id = e.target.id;
            var item = document.getElementById(id);
            if(item.classList.contains("svgSelected")){
                alert("has class!");
            }else{
                alert("does NOT have the class");
            }
@Dave are you sayin that using jquery is bad?
 
2:11 PM
No not at all
 
it's working this way... .classList.contains instead of .hasClass...
how would you do it with jquery instead of pure js?
 
Just to not rely on one thing
Can you create a fiddle of this bug?
 
why is that solution : $("#"+id) bad?
yes i will make a fiddle, cuz i'll have to work a lot on it... i have to "build" a "simple & custom" svg editor, here i'm just in the first steps, i don't really know svg... ^^
 
@Julo0sS it's way slower than getElementById
 
I guess it's just preference but, if there are performance issues I suspect minimal (unless dishing up huge amounts from the server) but it's cleaner to read
consider getElementById(id);
it's very easy to read
where as $("#" + id) is some how messy
or messier
personal preference though
 
2:14 PM
the truth is jQuery is not needed anymore
YES, it's bad
 
replaced with what ? @CSᵠ or, just replace with pure js?
I mean, are you "against" frameworks too, like Angular?
I use the word "against" loosely :)
 
he hates everything :P
 
ha ha ha ha
Hi Sippy
 
Hi
 
@Dave it also is a "code smell"
 
2:16 PM
If you're writing internal applications use jQuery
Cos it doesn't make fuck all difference if those users complain
 
@Dave most usage of jQ would benefit being replaced with pure js
 
Tell em its a feature
 
again, if you had my cooking @tereško, you'd find some of smells, but to some one else it isn't that bad!! I don't feel JQuery is a code smell
I also personally find $("#" + id) easy to read
it's just a string concatenation
I dunno
I guess because all my JS work is never run on a server, I have a different view!
 
@Dave is was referring to the fact that this would indicate abuse of ID attributes in the codebase a s whole .. therefore: code smell
 
@Dave jsfiddle.net/cgmm8bvd/1 here is the fiddle with the "bad" $("#"+id) thing :P
 
2:19 PM
ah, yes, agreed @tereško :)
 
@CSᵠ why?
 
because it's redundant and slow
 
@CSᵠ well, jquery is really slower then js? most jq code is "shorter" than original js isnt it? (i agree that it does not mean that it's faster, but it's "easier" to code...?)
 
@Julo0sS No.
Your code might be shorter, but you're including the whole jQuery lib for every page
 
@Julo0sS no
 
2:24 PM
14
A: How is the speed of a page affected?

Florian MargaineWell, check out by yourself: http://jsperf.com/gebi-vs-sizzle/2 jQuery slows down your application. A lot. However, as you can see on this jsperf, the operation, even though it's 10x slower than vanilla javascript, it can still run over 400k operations per second. Except if you're programming ...

 
not only you have to include the huge-ass library, you also have to execute code
 
On externally facing websites, I would not use jQuery
Fortunately I only create internal web apps for limited user groups.
 
If you write terrible code, speed is your least concern
 
@Julo0sS you need jq to select by id faster? function $id(id) {return document.getElementById(id)}
there done
want by tag/class?
improve on that
 
@copy lol, thx ;)
 
2:25 PM
there, no need for jQ
@Dave if you're using all of the features of a framework, you're doing something wrong, if you're not, you're loading up all that stuff for no reason
 
I've not used a framework and I was using all the jquery features but, things didn't work as I wanted so I ditched some jquery to redo it myself
 
@Julo0sS where you basically toggle your element.target (item) state using this toggler. var isSelected = item.isSelected ^= 1;
 
"^=1" ?
 
@Julo0sS, I don't know. Try using

$("#"+id)[0].setAttribute("class", "svgSelected");
 
@Julo0sS it's to toggle 0,1,0,1 and use it as a boolean
 
2:39 PM
@RokoC.Buljan thx a lot, what's "^=1"? how to disable all other items and only select one at a time with your code?
 
@Dave i meant in a single project, and if you did actuially use everything from jQ, ++ to you
 
ha ha ha, no no no
 
@Julo0sS simply store in a variable the current ITEM object
 
just a handful of things, :)
 
or better check for this.isSelected
before continuing with other stuff on item
 
2:42 PM
@RokoC.Buljan ok, your "offsetLeft" does not seem to work for me..
 
@Julo0sS I might be a bit off of conversation, but it works fine for me in FF and Ch
 
@RokoC.Buljan it displays "NaN" instead of the value.. guess it's me the problem :P
@RokoC.Buljan btw, i still do not understand what the ^= is...
@RokoC.Buljan sorry for "stupid" questions... :/
 
Regarding the offset you're right. (i'll take a closer look)
btw: http://stackoverflow.com/a/22061240/383904
 
Right, why does some one use a framework like Angular?
 
Angular? because mvc is good :P
and very suitable for lots of project
and no DOM manupilation
 
2:48 PM
Well yes. I like MVC and MVVM patterns
eh?
oh what
say hang on
oh???
no dom manipulation?
Would you be kind enough to elaborate dear chap?
:)
 
you do not mess with DOM directives does it for you
 
@Julo0sS (why you need the offsets at all? just out of curiosity)
 
Ah, because you've already set up binding?
 
and it is fairly decoupled not like messy jQuery
actually I am here for something else :)
 
@Dave you sure? Or were you referring to Rails and ASP.NET MVC ?
 
2:50 PM
is it OK to use hybrid database solutions?
like MongoDB and mssql side by side
 
Am I sure about what? I've never been sure before about anything, but explain more and I may be
 
@RokoC.Buljan well i need to get the position on the canvas now, to be able later to draw items with dom events (mousedown -> move -> mouserelease will draw a line for example with specific coordinates, or a rectangle, an ellipse, & so on...)
 
Well, both. Mostly though, MVC.NET but it still follows an MVC pattern
 
@RokoC.Buljan i have to "build" a simple & customized svg editor (only lines ellipses rects and text) but... i'm actually nowhere... just beginning it...)
 
however, I thought angular was MVW
 
2:51 PM
@Teomanshipahi that sounds like a nightmare
 
@RokoC.Buljan as it will handle svg objects, offsets (position) will also be needed for zoom things and scale of the "svg image"
 
So suggested approach is choose one and go all the way with that? @KendallFrey
 
One of our ex-guys said to use SQL at back, and mongo inbetween because it's caching is very good an you'll see performance benefits
 
posted on November 06, 2014

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-3727700-1"); pageTracker._trackPageview(); } catch(err) {} Whee!

 
2:52 PM
@Teomanshipahi That's what I would do
 
Never tested
 
@Dave it actually doesnt. ASP.NET MVC originally was a Rails clone and the the "ViewModel" concept in latest version is actually a variation on presentation models
In the proper MVVM the controller is replaced by viewmodel, which has different set of responsiblities
 
Really? I didn't realise that at all...
Yes, I use MVVM with WPF a lot and a lot and a lot
 
@Julo0sS ok got it Here you go: jsfiddle.net/cgmm8bvd/9
 
Even on tiny projects, I still set it up with MVVM
+
+1 @RokoC.Buljan
 
2:54 PM
@Dave are there controllers still in that code ?
 
@Dave thanks
 
in MVVM? No.
I have a model, a view model and view. The ViewModel is more like a mapping of properties really
I take all logic out, even my ViewModel is mega thin
 
hmm ... then you actually might be implementing it ... odd
 
well, the ViewModel does take the role of the controller if that's what you mean?
 
emm .. no
 
2:56 PM
but in regards to where the logic lives, I chose to not have it in the ViewModel
Since I have many views which could share similar logic
but not enough to share viewmodels
:)
sorry, my words are poor
no, the vm doesn't do the controller
 
@RokoC.Buljan thanx, now trying to "deselect" previous object... i'm wrong somewhere...
 
in regards to a controller in MVVM, there isn't one !
Is there?
 
@Julo0sS for your tiny project it would be fun for you to use some basic OOP in JS, means as soon you click an SVG element path you call in memory it's object containing every single information you've stored into it... (too long for a chant conversation, but just saying) so not only the stroke styles, colors, positions etc, but also things like isDraggable:bool zommable:bool userEditable:boolean zIndex.... it all depends on the size and scalability of your proj.
 
@Dave well , the there shouldnt be, but unfortunately in most of .NET literature they have fucked up the terminology .. again
 
3:02 PM
Ah good. Yes, I do find it confusing it's called MVC.NET I admit. I'm a big fan of MS technologies, but, yes, I wish they would adhere to standards
 
@RokoC.Buljan well, tbh i really don't know where to begin... it'll be possible to zoom in the container and contained objects should "appear" bigger, but their position always stay the same (relatively)
 
though, I would say that MVVM is better for cases when you do not really have a control (as in - ability to alter the public interface) over either model , views or both .... think - making a different UI for some proprietary SAP system
 
@RokoC.Buljan but this "zoom" thing is not my main problem... the main "important" functions will be to be able to draw things in my canvas and register it somewhere... now, for example, with a button, i'll enable possibility to draw a line. User should click in canvas (at position x y) and drag the end of the line at a second point (position x y) then build the <svg> corresponding tags (path)
@RokoC.Buljan you see what i mean?
 
@Julo0sS I see exactly what you mean! You want a blank canvas SVG and beneath let's sy buttons like [LINE] [CIRCLE] ..... etc
why don't you start building that buttons and start with some basic OOP in your JS logic!
 
gooooood morning
 
3:06 PM
@Julo0sS if I remember well, as soon you set width and height to an SVG Element that element will not be... well... responsive. viewBox or something like that should help.
 
@RokoC.Buljan exactly.. then when i'll understand (if someday i'm able to) maybe i'll give possibility to drag drop small images (...). I don't know exactly how it works for zoom within the svgcanvas, but i saw something somewhere that did not seem so complicated... it's "mousewheel" or something... event and action on canvas
 
@Julo0sS to recap, once the user clicks [CIRCLE] and starts creating a circle on the SVG, you create a new Circle() object. and as far the user operates on that element, means it has not selected any other or created any other Element, you operate inside that Object properties.
@Julo0sS leave that for a bit later, concentrate now on the basic stuff. For images it should not be much different beside the specific image attributes like x-link, clip-path etc...
 
@RokoC.Buljan yes, i think images should be "the easy thing" with it
 
but again you can have also your custom methods stored inside your app as an Image prototype.
 
@RokoC.Buljan w8 :)
 
3:13 PM
@Julo0sS the subsequent user-operations will always call the this (the Selected) element object
@eazimmerman never say "morning"! ;)
 
@RokoC.Buljan yes, if i want to interact with an object, but if i want to draw a line, i have to catch 1st mousedown to get "start position" and mouserelease to get the "finish position" then i have to build the <path> corresponding with the positions i got, and finally insert it into the corresponding <g> tag (i will have to deal with layers later)
 
@Julo0sS exactly.
 
good day
 
@Julo0sS so you need actually 2 different handlers, mousedown and mouseup instead of click
 
(unselect still not working, i'll think about that later) but http://jsfiddle.net/cgmm8bvd/20/
how can i "allow user" to draw after clicking on the button?
if, after click, i click on any shape visible on the canvas, it will select it.. and it wont draw anything
 
3:17 PM
@eazimmerman 8D just say "Good"! :D it's almost night here :)
 
@RokoC.Buljan roy-jin.appspot.com/jsp/svgImageHighlight.jsp here is what i found about the zoom function
 
@Julo0sS you need to create than some [CREATE] logic and [EDIT] logic in your app... I'm thinking about it.
@Julo0sS if there's no item selected... logically the user is going to use the Create one
 
@RokoC.Buljan or "if the user clicks on a 'create' button" it 'unselects' any item...
 
@Julo0sS or if you want to add the drag-to-select-elements function... than you should thing twice carefully.
yes. Clicking on the [LINE] for example ... you should de-select any selected.
 
Node event emitter is just for handling events on the server side ? (for example one module on server side emit event and another module also on the server side is listening for that event) while socket.io is doing same thing but between server and client(for example some module on server side emit the event, and some script on client side is handling that event)?
 
3:22 PM
@Julo0sS you can do it easily, you simply put that as a default assignment inside the create method (talking far) as the first line before doing anything:
`deselectElements();` That function will simply contain your de-select logic.
 
my "not working" deselect logic x) lol
 
@Srle Pretty much
 
@RokoC.Buljan all svg objects will have the class svgObject then i'll go with it to unselect them... guess i have to set "isSelected" to 0
 
@Julo0sS yes, but better create a separate function, cause by simply doing isSelected=0 will not undo the "red-selected-color" and other stuff (like event handlers etc?) to their natural state.
@Julo0sS after taking another coffee: you can simply use your item variable. if item exists means we're operating over an element I'm just not sure if you want to allow user-actions over the svgCanvasVisible element. I mean a click on svgCanvasVisible will return e.target as that element. I don't know if you want interaction with it.
@Julo0sS also, it would be good that you create an Array of selected elements. Imagine that I want to select multiple elements and set them to i.e: color=fuchsia ... it would be a pain to repeat all over again the same operation and I'd probably find a better tool online...
 
@RokoC.Buljan jsfiddle.net/cgmm8bvd/25 unselect & select ok (for me...) what do you think about it?
 
3:32 PM
@copy so lets say i add Backbone or something similar, then i have: handling events just on client side(backbone), handling events between browser and server(socket.io) and handling events just on the server side (node events emitter), so whole system is covered with events handling :D ?
 
@RokoC.Buljan yes, i thought about possibility to handle multiple objects at a time... but it's a bit too far for me...^^ (now..)
 
@Srle Depends on what you need
 
@copy im speaking just generally
 
Generally it will depend on what somebody needs
 
@Julo0sS $('.svgObject').isSelected = 0; is wrong. use item.isSelected = 0 inside the for loop
@Julo0sS I'd do it really using some basic OOP, really otherwise you'll end up with a huge and unmaintainable code... also it's a strange idea to set the stroke style to red... what if the user painted already all the shapes in red? :) hope you get the point...
 
3:45 PM
@RokoC.Buljan :)
@RokoC.Buljan but svg is only "text"... why oop with it?
 
@Julo0sS :) Luke, OOP you must use!
 
xD
 
@Julo0sS ok for your project you might not need it but... just saying
 
@RokoC.Buljan well, tbh, in my case, i just have to handle few objects such as <text> <path> ... and their properties (attr), thats why i do not really see any advantage to build my own "rectangle" class and use it as an object in my canvas...
 
@Julo0sS oky :)
 
3:49 PM
@RokoC.Buljan you really think that if i don't i will have problems with my code?
 
@Julo0sS no, not problem, nut you'll have more fun and flexibility.
 
@RokoC.Buljan any way to transfer this conversation in a "private" room? (i feel like spamming the room)
@RokoC.Buljan this may be good then, but the problem will be to understand its logic :P
 
!!go or not go
 
@towc not go
 
Erlang instead, then?
 
4:00 PM
!!go||!go
 
@RokoC.Buljan That didn't make much sense. Use the !!/help command to learn more.
 
So I gots me a new smartphone that runs Tizen. It's got pretty good html5 support - https://developer.tizen.org/dev-guide/2.2.0/org.tizen.web.w3c.apireference/w3c_api.html
I want to build an app this weekend, but I'm completely lacking inspiration.
Any ideas?
s/smartphone/smartwatch
 
4:25 PM
OK. I'll make a horse grooming app.
 
neigh
 
@PhilHudson 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.
 
4:58 PM
@Squiggle Inspiration is very difficult to give
 
hello
what i'm getting here is driving me a little crazy now..
ajax is going to error even when it is OK 200
i don't know why it is going to the error function.. most blogs and answers are talking about the dataType is not set properly but i have changed it based on everyone's suggestion and it didn't work still
i am not returning any data anyways..
i'm just inserting data into the database from a simple form.. so the backend php script is just inserting easily
any ideas?
ok, i just got the answer, datatype: 'html'
 
5:23 PM
@JoeSaad Easier not to specify a datatype.
    $.ajax({
    	url: url,
    	data: {
    		var1: value1,
                var2: value2
    	},
    	type: "POST",
    	success: function (result) {
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
		alert(textStatus + ", " + errorThrown);
	}
});
 
5:34 PM
@Sippy when i didn't specify, i still kept getting it into the error function
 
@JoeSaad Were you specifying content type as well?
 
ah!! you think that was the problem?
no! i'm not specifying content type
i haven't specified any
 
what were you passing as data?
Problem with PHP: shit debugging.
 
Php Has Problems
;)
 
Not that ASP.NET debugging helped me with AJAX the other day
Lol
But that had more to do with me being shit with dev tools I think
 
6:25 PM
TÜBİTAK_UEKAE_Kök_Sertifika_Hizmet_Sağlayıcısı_-_Sürüm_3.pem
Sounds reasonable that these guys have a root certificate on my box
 
6:40 PM
Sounds legit
@KendallFrey Php is the problem
 
@Neil PITP isn't as nice an acronym
 
Resist.. urge.. to google..
 
7:14 PM
Hi
 
@Neal Hi, doppleganger
 
@Neil I was here 1st :-P
 
@Neal Just like something my doppleganger would say
 
@Neil mmm hmmm
 
can any one help me with this
0
Q: how to stop execution of click event from onchange event handler

NinjaIn the following example http://jsfiddle.net/anu4nits/449d5j8e/ <input type="text" id="in" /> <input type="button" value="click" id="button" /> $('#in').change(function () { console.log('change event'); dialog.dialog("open"); }); $('#button').on('click', func...

 
7:33 PM
You already got some help
 
Guys, can you link me that script to show who stars things?
We might have a problem in the Lounge.
 
@R.MartinhoFernandes not sure, that may have been "fixed" since
I don't have it, but if you stop clearing stars, they'll run out soon
 
@R.MartinhoFernandes Gimme a sec, I'll hack one together
 
Someone linked to it on GitHub a while back but I didn't bookmark it.
 
@R.MartinhoFernandes courtesy of rlemon, gist.github.com/rlemon/6fb8b84d0288db65967f
 
7:43 PM
Or not
 
He says, just ignore the flag bit
He says, reporter.getStars()
 
Plaaaaay the best...sooooong in the world
 
8:05 PM
guys does it matter if a Javascript library has less OPS/second capabilities?
is it noticeable?
 
If you don't notice it then no
 
for example JQuery is able to do jQuery('#ten').val() for 182,933 times at second but another library 28,114
@Zirak ok :-) I was trying to think in which occasion would you notice such a "delay"
 
When you notice it
 
or put it.. would you begin to notice issues
alright :D
one must have like 20000 elements in a page to notice that
xD
no website like that exists haha
 
Exactly
2
 
8:13 PM
@SomeGuy ping
 
8:24 PM
well these guys debating over JQuery vs other libraries performance on hacker news are wasting their time :D
it could be a sort of premature optimisation
 
Yes, when talking about performance, it rarely matters
We don't like building web applications with jquery, for a variety of reasons
 
@copy right. for me, and this is my opinion, everything that makes my programming flow easier and crossbrowser handling goes
be it jquery or something else
 
Then again, if you just need to make a few dom modifications on a website (note that I draw a line between web application and website), jquery is probably fine (definitely better than the dom directly)
 
@copy yeah, that's talking about web development of course :-)
 
anyway to change the height of an element without adding stuff to its inline style?
 
8:29 PM
don't do it inline?
 
via JS.
 
hello, I am having trouble understanding something with regards to prototypes in JavaScript, but I'm not sure if I could turn it into a proper SO question, that's why I'm asking here
I've recently grasped most of the concepts related to prototypes, however, there is one thing that bugs me
the native objects (Function, Array, Date etc.) seem to have... instances of themselves as their prototypes
I'm not sure how to properly describe it, so I will use an example
when I type console.dir(Date) into the firefox console, I can see a tree of all the properties, along with the prototype property, which is simply displayed as "Date"
if I roll the drop-down to see what it has inside, there is no "prototype" property, which makes me believe that this is an actual instance of Date, however it makes no sense to me
still not sure if I made it clear enough, sorry
oh, and the question is: why is that so? is it designed like this or is it some implementation quirk? if it's the former, why? I couldn't find any explanation in Google, perhaps I was using wrong search phrases
what I expected the prototype to be was a plain Object containing the constructor and all the other properties, so I was quite surprised when I saw this
oh, and I guess I would never actually need to access the prototype property of any of the natives, but I'm playing with it to find out more about the whole prototype thing
 
is there anyway to alter the JS code (similar to css) when looking at a page through the chrome dev tools?
 
8:49 PM
@rhino tldr; but yeah, since a prototype has the same methods (not necessarily also properties, but I think in this case properties too), it looks like an empty instance of that "class"
For instance, when you type new Date into the console, Date.prototype.toString() will be called with that date object
If you type Date.prototype, the same method will be called
The reason for defining Array.prototype.length as 0 I don't know
 
@copy perhaps it is set up this way to ensure that every newly created array will have the length property
 
Possible
 
9:06 PM
@copy I just found this in ECMAScript 5.1 spec: "The Array prototype object is itself an array; its [[Class]] is "Array", and it has a length property (whose initial value is +0) [...]"
but it is not explained why
 
That wouldn't make a terrible SO question
 
has anyone seen this?
 
I have seen llamas with hats
probably not that video
 
Everybody who has been on the internet once
 
@copy ok, I will probably post it as a question then, thanks
oh, it seems someone has asked a similar question before
but the mystery remains unexplained...
 
9:25 PM
@rhino Think of it like this: An "instance" is just a copy of the prototype, there's no way to distinguish between the prototype and its clone.
So what's being said is that Array.prototype is an empty array
Same way that Boolean.prototype is false
 
It's like I was blind, and now I can see
I always thought of prototypes as base classes :/
 
It's natural to think that way if you're coming from "classical" languages, but new in js is simply fun.call(Object.create(fun.prototype), ...args)
3
 
waaat
crazy
 
Prototypes biatch
It's objects all the way down
 
Crockford says, don't use new.
 
9:31 PM
I new it!
:P
 
Like many Crockford sayings, that one grew on me. I haven't used new in my code in ages.
 
Do you use the call create approach?
 
Trying to get rid of Object.create as well
 
purely module?
 
Just functions returning objects
 
9:32 PM
deja vu
 
@Zirak but if, say, Ctor() is a constructor and Ctor.prototype contains a method called print(), and there is an instance of Ctor, called obj, then obj.hasOwnProperty('print') === false
 
@rhino That's because of the "cloning"
The "instance" of Ctor has its [[Prototype]] set to Ctor.prototype
 
I'm not sure if I understand you - if an object called X was an exact clone of a prototype object Y, then X would "own" all the properties that Y owns
not just have the ECMAScript implementation find them in the prototype chain
 
Hence "clone" in double quotes
Play a bit with Object.create
 
@Zirak - Do you write js more server side or client side?
 
9:38 PM
End result though is that if you create a prototype, you get what seems to be the original, you just get one step of indirection
@TravisJ shrug
 
50-50?
 
One of my coworkers got pissed at my mechanical keyboard today. Boss had to tell him to deal with it, Swift is strongly typed.
punny
 
I just did:
function Ctor() {}
Ctor.prototype.func = function() {
console.log(123);
};
var obj = Object.create(Ctor.prototype);
obj.func(); // logs 123, there is a property called "func" on the prototype chain
console.log(obj.hasOwnProperty('func')); // false, it is not an own property
whoops... messed up the formatting, sorry
 
Inspect obj in the dev tools, poke around it, look at __proto__
When you, as a 3rd party, looks at obj and start running over its properties, it looks like it has everything Ctor.prototype has. So as far as you're concerned, it could just as well be Ctor.prototype
Also remember that Ctor.prototype is just a regular object, you don't have to use a function. var parent = { foo : 4 }; var child = Object.create(parent); works just as well.
 
all of this is too complicated for my simple mind
 
9:46 PM
That is because the Ctor does not have a property of func. Its prototype does. (new Ctor()).hasOwnProperty('func') will be false as well.
 
@Zirak yeah, tried that
@TravisJ yes, I am only arguing with the statement that an instance of Ctor is an exact clone of Ctor's prototype
 
But he said "clone"
 
It's not really a clone
 
Its more like mini me from Austin Powers :P
 
It's very convenient to think of it as a clone
 
9:51 PM
wow, that's a very nice webapp you have there :)
give me a second to look at all the input and output
@Zirak well, as far as I'm concerned, this example hasn't really introduced anything to our conversation
I can see that when the child object is inspected using dev tools, it has all the (prototype) properties enumerated for convenience
but child.hasOwnProperty('foo') quickly reveals the truth
so yeah, perhaps it is convenient to consider it a clone, but I think I personally won't
 
Wow this place is crickets now lol
 
Thursday is the new Friday
 
@TravisJ Hmmm?
 
@Zirak might be better to explain? jsh.zirak.me/ov29
 
@FlorianMargaine I think I still don't understand... what I see there is that child.__proto__ is a reference to parent
 
10:05 PM
that's what I understand too
 
user393219
Hey guys, I'm slowly checking out MEAN.io right now and looking at their scaffolding mad me have a quick question: why do they have separate package.son files in each "module" of the app.

For instance, there's a packages folder in their hierarchy which contains an articles module, with all front and backend logic for articles, plus a package.json, which seems redundant as soon as you add another module to the app.
 
@ShawnStrickland 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.
 
@Neal - I guess I missed what happened?
 
@TravisJ What happening with what? I am confused X_x
 
@Neal - Oh, me too then I guess
 
10:10 PM
@TravisJ k. people jumped ship for miaou
 
I thought when you said this place is crickets now you were referring to JHawins getting banned
 
lol
@TravisJ He was? when/why was this?
 
@ShawnStrickland All npm modules have their own package.json files to control their dependencies.
 
@Neal - Not sure, reading the ecma transcript atm
 
user393219
@Retsam I see, so even a custom "feature" to a webapp is considered an npm module?
 
10:12 PM
@ShawnStrickland Depends on how it's structured; I really know anything about MEAN.io, specifically; I'm just going off what I know about Node in general; but yes, you could structure it that way.
 
@Neal - i think it starts here
@Neal - specifically
 
user393219
@Ret
 
user393219
@REtsam sweet, thanks for the info
 
10:49 PM
Hi everyone
I am trying to use window.prompt to add a name in the alert box but somehow it is not working for webkit. Is there any alternative to window.prompt
var newName = window.confirm("New Metric");
sorry var newName = window.prompt("New Metric");
this is not showing any text box to enter the name
 
@Neal - That was a lot of reading =/ I know kung-fu
 
00:00 - 14:0014:00 - 00:00

« first day (1482 days earlier)      last day (3481 days later) »