« first day (16 days earlier)      last day (4938 days later) » 

12:47 AM
:(
 
 
8 hours later…
8:57 AM
@Tom are you sure that this refers to your object and not the DOM or jQuery object ?
 
 
3 hours later…
Tom
11:50 AM
Hi folks, I've been working on a hooking library (AOP like) that allows you to hook into an object's constructor, like this:
1
A: How to get AOP-like object beforeConstruction hooks in Javascript properly?

Shane TomlinsonHi Tom, not sure if this is what you are after, but you could try looping over all the properties in the original someObj and copying their values to newObj. Function.prototype.beforeConstruction = function(newFunc) { var oldObj = this; var newObj = function() { newFunc.apply(thi...

The problem is that it requires a clone of the previous obj, modification, and even reset all static fields etc. aka it is not very efficient.
Does anyone know if there is a better way?
 
 
2 hours later…
Tom
1:28 PM
Well, can sure notice it's monday ;)
 
2:16 PM
God, tehres no-one here?
@Tom what do you want to do with the hook? just catch the construction event and then call a onbefore constructor?
 
@Raynos All Quiet on the Javascript Room Front
 
@Tom I don't know what you want to do with it? The meer act of constructor a new object should overwrite anything you do on beforeConstruction
@YiJiang Mondays shouldnt be this bad
 
Tom
@Raynos, I want to execute the given function in the constructor (it hooks into the constructor)
Thus i have access to this instance's fields inside the hook
The code I posted in the question works, but it is not efficient
 
@Tom have you considered making an event callback for beforeconstructor? something like
function createObject(cons, precons) { var obj; obj = cons(precons); return obj;}
@Tom I misread your example someObj = someConstructor.beforeConstruction(func); dont use the someObj for the obj created and for the name of the constructor function
@Tom I can't think of a better way apart from triggering beforeConstruction events
 
Tom
2:35 PM
@Raynos, no because I do not want to modify the object when I define it, as this has to work for existing libraries
 
@Tom plugins.jquery.com/project/AOP look at that source. See if it does it differently
 
Tom
@Raynos, that plugin does not allow construction hooks only methods.
 
@Tom I mean read the source for to implement AOP practices in javascript. I guess its different
 
Tom
@Raynos, I told you, they do not implement what I want at all :)
I'm not trying to make an AOP library
@Raynos the problem is that one apparently cannot set obj.prototype.constructor = function (..
thus it looks like the only way is to clone the obj but change the constructor
but maybe someone knows otherwise
(that plugin does not though)
 
I see what you mean
 
Tom
2:46 PM
well, maybe this is the only way. thanks for the help though, /afk
 
Pol
suggest me please an online javascript tester!!!
I got it jsfiddle.net
:)
 
notepad.exe <html> <head /> <body> <script type="javascript"> // CODE HERE </script></body></html>, save as test.js, run in ie4
 
3:31 PM
aye, jsfiddle is awesome
the SO fiddle I use for jQuery/UI questions: jsfiddle.net/nick_craver/mHvvA
 
@NickCraver I should probably bookmark that, then fork it when I need a new one. Much (well.. not really) faster than having to redo the settings everytime
Also stops me from typing out something, run it, before realising that it was using MooTools instead of jQuery
 
4:09 PM
hi
 
@bhups hi
 
@Raynos Hi, need some hel regarding DOCTYPE
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">
 
@bhups I don't think that's widely recognised
 
what exactly is the impact of this particular DOCTYPE on rendering
 
@bhups The only thing that will affect the rendering of the page
Is if the browser doesn't recognise, or sees a very old doctype
It will switch to Quirk Mode if either of those are true
 
4:15 PM
@bhups if possible avoid using that
 
unfortunately I don't have any control over that
 
Quirk Mode is basically IE5.5 Mode. The box model is semi-broken, and a bunch of other stuff happens
 
Quirks mode is basically pure hatred.
 
<html>
<body>
<div style="background:white;width:620px; height: 464px; overflow: hidden;"><style>.v{width:100%;background: red;border:0px; color:#FFFFFF;text-align: center; font-size: 11px;font-family:arial; vertical-align: middle;}</style><a target="_blank" href="http://www.google.com/"><div style="height:28px;width:620px;display:table-cell" class="v">Video</div></a><video style="background:black" height="408px" width="100%" ></video><a target="_blank" ><div class="v" style="height:28px;width:620px;display:table-cell">Bottom</div></a></div>
 
Remind me again what does !!obj actaully do?
 
4:20 PM
what?
 
@bhups I dont know what a doctype of xhtml 1.2 will do to your video
 
And if I add that DOCTYPE then it starts showing a white line below the black video box.
videos plays fine, but somehow that white line shows up
 
@bhups check your settings as to whether your running in quirks mode
 
@Raynos Sure :)
 
@bhups ctrl+shift+J document.compatMode
@bhups if its backCompat then your in quirks mode if its CSS1Compat then your normal. If your in quirks mode then you get the white line because quirks mode is shit. Either manually hack the white line away or dont use a silly doctype
 
4:35 PM
ok sure
 
4:51 PM
ejohn.org/apps/workshop/adv-talk/#17 Could anyone explain this? and what it does?
thats in context of the slide above it
 
@YiJiang Unknown doctypes that are syntaxually valid are in standards mode
 
5:37 PM
@Raynos I believe it sets up code to handle events that may not natively be supported by a particular browser. The next slide says "You can use special events to simulate other events. We use it for: submit, change, mouseenter, mouseleave, focusin, focusout."
Actually it's the previous side, not the next one.
 
6:02 PM
hi all
 
6:56 PM
hola :)
 
sup
 
 
2 hours later…
Pol
8:29 PM
ajaxForm plugin is not working in IE.... Someone know why?
 
@Pol is there an SO question about it? What does "not working" mean?
 
Pol
Sorry.. That it is not sending data... and gives me error status instead!
 
@Pol well I'm not sure what that means - maybe you should post a question and include the error your getting, the code, etc
 
Pol
I found it... I did not close form tag!
In firefox it worked.. but IE always special
@Pointy Thanks for trying to help!
 
8:45 PM
OK well that's good!
 
you win the "Vaguest Question of the Day" award!
 
8:58 PM
@Pol - let's be clear here, you not closing a tag, and therefore having invalid HTML is not IE being special (though it often is "special")....that's other browsers tolerating your invalid markup
 
Tom
Hi folks, how would I set the html of an iframe without src tag? $("#frame").html("<p>test</p>"); does not seem to do it.
 
Pol
My fault!
 
@Tom I'm not sure that you can do that. An <iframe> element doesn't really have content like that; it's a separate DOM structure.
@Tom Now you might be able to get at the document in the frame and use document.write() to stuff content in there.
 
Tom
@Pointy, $("#frame").document.write ?
 
No it'd be something like (assuming jQuery) $('#frame').contents().document.write() -- I don't think I've every tried that however.
 
Tom
9:08 PM
@Pointy, I thought contents returned all elements
 
or maybe $('#frame').get(0).contentWindow.document.write()
 
Tom
all children
 
Yes I think you're right - I had to go check some old code I've got that does access the frame content (doesn't try writing to it however)
 
document.write() == evil, avoid at all costs
 
Tom
I will try avoiding iframes then and use divs
 
9:09 PM
@NickCraver agreed - it's the only think I can think of. Of course if you can get to the content document you can always manipulate that DOM directly.
 
Tom
I wanted to have a separate dom, which is why I wanted to use iframes, maybe I can somehow work around it though
 
2
Q: Write elements into a child iframe using Javascript or jQuery

Jeff Meatball YangI have something like this: <html> <body> <iframe id="someFrame"></iframe> </body> </html> And I would like to use jQuery to write elements such that the full equivalent HTML would be like this: <html> <body> <iframe id="someFr...

they key is calling .open() on the document for an empty frame before you can write to or otherwise use it
otherwise it won't be initialized
 
Tom
I wonder if this is cross browser
 
So @Nick when you code an <iframe> without a "src" attribute does the browser give it a fresh window anyway? In other words, is "contentWindow" non-null and actually useful as a window (like, there's a presumably empty "document" attribute)?
 
Tom
@Pointy I believe document is null, just tested
 
9:12 PM
I know that IE gets upset about <iframe> elements with no "src" being used in https pages - you get the "secure and insecure content" warning (at least you used to with IE6)
 
iirc depends on the browser
 
Tom
So I have to give it some empty source
 
if you look in that question you'll probly see a undefined check around .contentWindow
will take a look in a bit, trying to get Chirpy to respect mashed file order atm
 
Tom
Actually, with some modifications I can use a normal div, which should be much better anyway.
Thanks
 
I've used $('#myIframe').contents()[0] to get the `document`of the iframe before -- is that evil?
 
Tom
9:25 PM
@lonesomeday, that doesn't return the html element?
 
@Tom no, it returns the HTMLDocument node
 
Tom
interesting, I don't see why, but ok
 
Tom
9:40 PM
Is it ok to ask about html/css here?
 
The CSS room is pretty dead
 
Tom
I know @Pointy, which is why I asked
 
Well I don't know who's in charge :-)
 
Tom
Basically, it makes no sense to me that the inline display here causes the forced width/height to be lost: <div style="width: 200px; height: 200px; border: 1px solid black; overflow: auto; display: inline;">test</div>. Removing the inline display results in the width/height to be restored.
I guess everyone is in charge. : )
 
@Tom You can't set explicit height and width on inline elements
Use display: inline-block if you need to do that
 
Tom
9:48 PM
Oh, I didn't know that
Thanks @YiJiang
 
 
1 hour later…
10:57 PM
@Pointy Nobody's in charge, really, 'cept maybe @balpha when he's around. I created the room when chat launched and I gave @NickCraver ownership privs because he's in here more than I am. As far as off-topic conversations go, I sometimes clean up stuff that's way off-topic or stuff where people are just testing the chat, but only if I'm around at the time. I don't go looking for it :-)
@YiJiang IE 6 has a issues with inline-block on elements that are block by default. inline elements should be fine with it, though.
 
11:19 PM
note that IE6 has issues with <insert every other css feature here> as well
7
 
11:30 PM
@NickCraver: stop zinging Internet Explorer, you're overcrowding the starred section ;-)
3
 
At least IE lets you link to more than 31 stylesheets if you want to....oh, wait.
 
11:54 PM
I can't say I've ever come across that limit
I bet some wordpress users have though
see what I did there? that's for you wordpress users, quit making pages that request another 40 files damnit
 
Heheh ;)
 
so its npm the de-facto node.js packager these days?
I know there were a few others, but has npm taken the "lead" so to speak
 

« first day (16 days earlier)      last day (4938 days later) »