« first day (3240 days earlier)      last day (1933 days later) » 
00:00 - 21:0021:00 - 00:00

user8729657
00:41
lol
03:07
I need to go to bed. I just tried to select a class by doing input[class=class-name]
03:49
wtf
Anyone know how to get Google Picker Javascript API to return a drive folder and its contents when using drive.file scope? It seems I can ask the user through Picker to pick a folder, or pick a bunch of files, but not both. So it gives the app access to one but not the other.
 
2 hours later…
06:01
Yay, I made my first express app
I like it
I am slowly moving away from PHP
06:47
@JBis it's a whole new world
 
1 hour later…
08:01
!!(020202).toString().substr(0, 2)
@Cleancode That didn't make much sense. Use the !!/help command to learn more.
you have to use !!>
08:45
hmm had to correct a co-worker
he needs the form from a given input element. So he put a while loop to go through the dom hierarchy to find the said form
that loop is not even required lol
just urInputEl.form
and he was baffled
lol
he must be fresh from the backend
yes. but it is not that widely known tho
just checked, see this stackoverflow.com/questions/991367/… for example
well I mean you can also query the form, assuming you didn't know you could do that
highest voted answer isn't a good one
172 votes vs measly 37
he references w3schools ffs
08:52
hi
@J.Doe Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
@J.Doe yo
when should you use design patterns in JavaScript?
when it could solve a complex problem?
I guess you could achieve the same result with and without the design pattern, so my question is about - at what stage am I going to need design pattern? Todo app - anything works, no design pattern needed. Small module - anything works. So when will I need design pattern?
or will I ever need design pattern?
DOM manipulation - anything works, no design pattern needed... ?
08:58
if you see an emerging problem with program design that could be addressed using a design pattern with no significant downsides, you use it
But you wouldn't use a design pattern just because you studied it and you're anxious to use it
and it's also tricky to know the difference :)
That what I am on about - what if I dont see the difference - this invisible line to cross between 'whatever works' and design pattern usage ?
can you point to an example of code / app that uses design pattern is the right size and problem for it to use deisgn pattern please?
@J.Doe I don't really think it's an issue until you're trying to use a design pattern and it still has major issues that it didn't fix
in other words, not really a big deal if it's overengineered. You'll learn with time that it was somewhat unnecessary
@Neil Thanks
09:03
just don't try to make a round peg fit in a square hole
and you kinda have to try out patterns before you get a feel for them too
so if you're writing a program for the purpose of improving your skill, try design patterns
you learn a lot that way, one way or the other :)
@BenFortune what a bloat
09:46
how to get a row's child number on a table using jquery?

i have a row without class of id. I want to get the row's child number on the table
10:04
I was experimenting with Sigma with react these last few weeks for network visualisation, I am kind of not happy with the amount of documentation available to achieve some of the things I recently encountered cityscape and it at least looks pretty good has anyone used them both can anyone give me some good comparative analysis if cytoscape can be a good option
great Neil. thank you!
10:20
Guys, does anybody know how could one lazily load multiple module in a single view without changing URL?
 
1 hour later…
11:34
yeet
w00t
so... I am going to build a fiddler website and I am looking into what I could use as code editor.
Anyone has suggestions for a code editor where I can easily apply syntax highlighting without defining a syntax schema?
Thank you for recommend me debounce function the other day, it´s very simple and it solved all my problems
Debouncing is fun, and ridiculously easy to do
@Wietlol Language detection is hard, that's why most libs don't do it
11:48
what I basically want is syntax highlighting, not autocompletion or anything fancy
the idea is to make the compiler tell the ui what parts should be highlighted as <x>
for example, the compiler will say:
{ type: "keyword", from: {line: 5, column: 10}, to: {line: 5, column: 15} }
and basically give a list of all these things
The compiler?
and the ui then needs some registry of types and style to be applied to those pieces
for example:
{
    "keyword": {
        color: "#......",
        font-weight: "bold"
    }
}
@BenFortune compiler, yes
TIL that's called debouncing
What languages are you supporting?
Fun fact, if you do this in acucobol, it breaks the event loop
I actually broke the runtime entirely trying to implement a debounce on a search box
11:53
uhm... my own
so, no... none of the existing libraries supports the syntax out of the box
Have a look at the language server protocol, and write your own definitions
hmm... looks interesting, but I doubt it can support my language
how so? you make the definitions at your own
Obviously it won't, that's why I said write your own definitions
@BenFortune hljs does a shit job
like 50% accurate
11:59
I think prism has it too
none of them are good
@BenFortune I mean... not just out of the box, but cannot support it at all
the language's syntax is dynamic based on the code you have written
this is why a compiler is mandatory to be able to understand the source code and highlight it properly
there are also cases where it is impossible to infer a language
var i = 1
what language?
I dont have to infer which language you use tho
but for example, var var = var
this is sort of valid, but each var is something else and requires different highlighting
the only case where I can see this as being valid is in a local variable declaration with the name var that shadows a parameter which is also named var
@BenFortune the LSP would allow me to write the code in any IDE, right?
assuming that they have an LSP client
12:20
such ide's are using LSP to provide syntax highlighting in their code editors, something you want. Or not?
what age did you all start programming
Is there a simpler way to write this?
document.querySelectorAll("a").forEach((a) => {
    a.addEventListener('click', () => {
        //stuff
    })
});
@Dwigh the third age
how old were you when you started programming
@SilverSurfer depends on if you use closures or not
@KarelG at this point, I dont really care that much
12:28
@Wietlol What do you mean?
I dont really need to be able to write it in IntelliJ, or VS Code or emacs
I just want a fiddler on the web
the only thing I do want is syntax highlighting
mostly because of displaying warnings and errors and hints and such
So you need your "compiler" to output in a format that the library supports
@SilverSurfer
So I'm not sure what you're asking
12:30
@Cereal
Every single syntax highlighting lib is going to require some sort of definition
document.addEventListener('click', e => {
  if(e.tagName === "a") doStuff()
});
or something
Thats ugly :(
I am looking for a way how to apply css to a part of the text
a library to deal with the highlighting would be fine too, but I dont think many will support the approach I use
@Wietlol wrap it
12:31
It's literally exactly what you wrote, with no iteration
that is what LSP does -.-
wrap it... like... spans? on text inside a textbox?
*puts hands in the air, shakes head and continues working*
@Wietlol contenteditable div, not a textbox, but yes
And if I wont add it to the document?
12:33
hmm...
Ill try that
You're going to have a difficult time clicking the button if it's not int he document
Array.from(document.links, (i,link) => link.addEventListener('click', handleClick));
try this.
much prettier
contenteditable divs appear to work fine, I'll try to use that for the time being
@rlemon I don't think document.links includes all anchor elements
injected ones aren't on it AFAIK
anyone used svelte in real project for real clients? and what was the outcome?
12:37
> The links read-only property of the Document interface returns a collection of all <area> elements and <a> elements in a document with a value for the href attribute.
wtf
@Wietlol that what most online ide's do
oh I see (checked the standard). Makes sense,
so it only includes if you have area.href or a.href in your document
@J.Doe I used it for a project
the outcome was it renders the frontend
@KarelG Similarly to document.forms and document.all
apex lookups
12:45
This is DOM since before document.getElementById and co.
that "wtf" was on the area elements. Did not expect that
only way to use my super modern image maps
You can also access elements by ID without querying for them
@Cereal that is a good outcome :) do u mind sharing the link ?
12:48
@Cereal thanks
0.o?
we have a new J. Doe ?
I still have a conflict with javascript selectors and events. According to this repo https://github.com/nefe/You-Dont-Need-jQuery#query-selector it says specifically
"document.querySelector and document.querySelectorAll are quite SLOW, thus try to use document.getElementById, document.getElementsByClassName or document.getElementsByTagName if you want to get a performance bonus."

So I have when with with jQuery I can just do $("#whateverElementIneeed") with javascript I should be think about wich of them I should use in a different case. Even you wrap it in a $ it is still be laborious to me
they're slow__er__
but still plenty fast enough
so, keep it in mind, and ignore that site
Performance doesn't matter until someone notices
well in this case, the method you choose to do the lookup is moot
if you have performance issues with dom lookups you're doing too many too often
12:53
Even without having performance issues you still have to choose wich one you should use in each case
Gunna be honest, if I'm in a position where I'm using selectors, I'm probably also using jquery :D
I like the new ES6+ syntax really, but there are some things are not still ready
@rlemon or have a too large dom?
I know some websites that are not fun to load because of their size
that's not lookups
that's loading a massive dom
I'm not sure how lookups would be impacted
but I still doubt it will be slow enough to notice.
@Wietlol Wait, you're not normally in this chatroom.. are you following me, sir!?
go to ecma site and load the spec and do a lookup
@Neil no, not really
I came here to find out what to use for a fiddler website
(answer was contenteditable="true")
@Wietlol often mixed with an off screen text input
kinda an important bit
off screen text input?
why so?
yea, so when they type you have it pretty in the content editable with all that juicy html for formatting
13:00
my last bastion of Wietlol finally falters
but when you want the actual text of the code, you don't have to fuck with stripping it
the text input mirrors the visible code in the contenteditable.
sans the html ofc.
isnt there an innerText property?
im not sure how I would sync the textbox with the editable div but innerText sounds a lot easier
@Neil 0.o?
I think there is a caveat to innerText
but I can't recall. so use it until it doesn't work I guess
@Wietlol Neil is fearing he's not safe for you anymore since you're here as well
but he has his buddies. 🏏
dont worry, ill be gone in a few hours
and then I will never return
until I return
13:09
I'll never chat again, until I do
13:44
Do we have gold badgers in here that can re-close stackoverflow.com/questions/57727833/… as a dupe of stackoverflow.com/questions/14220321/… ? Someone re-opened it to answer it, while it's an obvious "return response from async" question.
stackoverflow.com/questions/24989475/… this is also a good dupe target...
I am trying to dynamically add listeners to all inputs within a form:
$('#main_form').addEventListener("focusout", ev => {
        if (ev.target && ev.target.tagName === "input") {
            saveToStorage();
        }
    });
The above does not seem to work.
@JBis you're attaching the event listener to the form, not to the inputs themselves
@JBis You're mixing jQuery and native JS
@Neil Yes, I figure that is what you have to do. I did it for my click event and it worked.
13:50
@JBis fair enough
also addEventListener is not a "jQuery" thing
What do you suggest instead?
document.getElementById('main_form').addEventListener ...
or $().on(
or you could go the jQuery route
why not use just this
$("p").click(function(){
13:52
oh shit sorry I forgot this part:
 const $ = document.querySelector.bind(document);
 const $$ = document.querySelectorAll.bind(document);
@SilverSurfer He's not listening to the click event.
I know just was a copy paste
its not jquery its just a shortcut because I'm lazy
solid 😃
13:52
@SilverSurfer this isn't dynamic and its jquery
that's going to cause a lot of people to misread your code you know :P
I really don't want to go the jquery route if possible
@JBis Does not work in this case because focusout has to be listened for on the inputs
document.querySelector('#main_form').addEventListener("focusout", ev => {
        if (ev.target && ev.target.tagName === "input") {
            saveToStorage();
        }
    });
Boooo :D
13:53
@geisterfurz007
3 mins ago, by JBis
@Neil Yes, I figure that is what you have to do. I did it for my click event and it worked.
Derp; misunderstood that message, sorry
So how shall I do this?
Array.from($$('#main_form input')).forEach(input => input.addEventListener("focusout", ev => { /* ... */ }))
Or something
Maybe could help you
Someone's using try/catch/finally instead of a Promise's finally, here...
13:57
I'm gonna ask on SO
and then get closed as dup to the answer
Any idea why this gives error /(?>\w+\.?-?)?(?>\w+)@(?>\w+-?)+(?>\.\w{0,3})+m?/? (Uncaught SyntaxError: Invalid regular expression Invalid group). In regex101.com it woks
what's the question
?
What is wrong with the code snippet I posted JBis? :c
@EnderLook I assume you have regex101.com set to php on the left side of the editor?
Change it to ECMAScript in that case.
@geisterfurz007 Aren't you gonna end up with a bunch of listeners on one input? and also thats not dynamic.
@geisterfurz007 Oh, didn't know that. Thanks!
13:59
@rlemon If talking to me:
10 mins ago, by JBis
I am trying to dynamically add listeners to all inputs within a form:
@JBis Why would that be the case? document.querySelectorAll will select all input tags within the element with id main_form. For each of those tags add an eventListener for the focusout event.
And how is that not dynamic?
you're way over complicating things
@geisterfurz007 are you gonna run it every so often? whats gonna tell it to update when new elements are added?
Oh! I wasn't aware that that was your usecase, sorry. I thought you'd run it after some form was built up.
@rlemon yeah, so why the fuck didn't work on mine :( one sec
14:03
!!tell JBis magic
@JBis (∩ ͡° ͜ʖ ͡°)⊃━☆゚. * ・ 。 ᵀᴴᴱ ᴳᴬᴹᴱ
godamnit js
ev.target.tagName.toLowerCase() === "input"
why in the gods name does it return upercase
who uses uppercase tags
because it's stoopid
14:04
its not godamn 1990s
fucking js
thanks rlemon
and yes I could do === "INPUT" but then I would be giving into Js's stupidity
HTML's actually
5
Q: Why does tagName method in JavaScript return HTML tags in capital letters?

PawelChylaWhy does tagName method in JavaScript return HTML tags in capital letters? HTML tags should be written in small letters.

yea, don't blame JS. that's DOM specific HTML stuff.
XML is all lowercase
figger it out
We stand on the shoulders of people who seem like giants only because they always shouted, apparently.
how can I use django with react/next.js?
(I barely know what django is, yes I have read what's available on the web)
14:17
Same way you would anything else
You just don't get SSR
if I don't get ssr then next.js has no purpose
because its basic aim is SSR
its basic aim is to vendor lock lmao
14:38
Whats the equivalence of this in javascript? In the most simpler syntax? @ndugger
$('#menu').on('click', '.nav li', function() {
    // stuff
});
are you asking in good faith? or are you trying to find examples of things that you can say "SEE JQUERY IS RELEVANT"
In good faith of course.
menu.addEventListener('click', evt => {
  if( evt.target.tagName === 'LI' && evt.target.parentNode.classList.hasClass('nav') ) {
    // stuff
  }
});
then here it is
@SilverSurfer

document.querySelector('.nav li #menu').addEventListener('click', event => {
// stuff
});
14:42
I think
shorter code if you don't delegate
but more work
I don't know how jQuery's context works
@ndugger Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
I guess you could just select by the ID, since that's unique
14:43
document.getElementById('menu').querySelectorAll('.nav li').forEach(el => el.addEventListener('click', evt => {

}));
would be another way
Oh thats look nice
no it doesn't
looks nicer than jquery
delegation is what jquery is doing, and my first demo shows that
1 min ago, by rlemon
menu.addEventListener('click', evt => {
  if( evt.target.tagName === 'LI' && evt.target.parentNode.classList.hasClass('nav') ) {
    // stuff
  }
});
should be classList.contains
brain fart
14:46
Do you know any web with examples like this? To have as reference
github.com/you-dont-need-x/you-dont-need-jquery covers some basic scenarios, but you could extrapolate
menu.addEventListener('click', ({target}) => {
  if( target.tagName !== 'LI' || target.parentNode.classList.contains('nav') ) return;
  // your stuff
});
slightly cleaner.
Oh thats nice
@SilverSurfer learn javascript and read the jQuery source code
> says that an if statement without braces is cleaner
14:48
ohh sorry nick, I'll clean that right up for you
everyone knows on a scale from 1 to 10, my opinion is a 9
good thing my give-a-fuck scale is 0-100
you're ranking real low bub
unless 0 to 100 is binary, in which case a 9 is damn nice
is Django similar to Express in node?
not really
15:01
on a scale of 1 to 10, my opinion is Wietlol
prove it
> Wietlol
white lol
user11867329
Good news everyone!
15:17
🚽
15:30
guysss i need help with curried function
@Peter Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
which is just many lambda into one line, this is very confusing and stackoverflow does not really help
const pair = (x, y) => f => f(x, y);
I am given this function which returns f(x,y); but what does it mean?
function pair(x, y) {
  return function(f) {
    return f(x, y);
  }
}
hmmm
but what is the returned function f(x,y)
15:35
it's whatever f does when f is called with x,y
1 message moved to Trash can
@Peter Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
because the return value is returning me a empty function f(x,y)
why doesn't it return me the value when i call pair(3,4);
15:49
@Peter you're not returning an 'empty function'
f is defined somewhere
err, it's the param
kyl
kyl
16:14
how are you devs!
awesome
kyl
kyl
anyone knows good way to make resizable table. (for my vue project)?
I want to make table to be resizable (actually resize column width) by dragging vertical line between columns
Do you want to make your own or use one of the probably countless data tables already built for you?
kyl
kyl
I want all columns to keep the width after the dragging line
I don't need to make my own if existing one is good enough to use for your project
I don't use vue or know much about it, but this was the top google result: github.com/vue-comps/vue-data-table
The query I used was: vue data table resizable columns
kyl
kyl
16:19
@ndugger Thank you for your help. I'll try it.
what I want is I can make width even to be 0
Why would you do that? Just add the ability to show/hide columns at that point
yeah, i prefer to limit what users can do with a table, rather than make them free to do everything when they'll rarely do much more than look at it
If they wan't excel, they can export it to excel
kyl
kyl
yes.
Yeah, I've had to deal a lot with editable data tables in my career so far, and my experience has been that there is usually a much better UX for what they need to accomplish, and as Kevin said, exporting to excel solves like half of their problems
kyl
kyl
in my case, user will click some filters and that will decide columns count.
and user will compare some columns, so user will make close specific columns for easy comparison
anyway.. @KevinB, @ndugger Thanks for your opinion. :
:)
16:28
yeah, we used a 3rd party SEO solution recently that had a pretty good setup. The filtering/sorting/column showing/hiding was all handled by a toggleable form above the table. The default view was good enough for most usecases, but then it had an easy to use form that you could change the table with to better fit your needs, without all the complex logic that would be required to implement it directly into the table.
kyl
kyl
@KevinB Could you tell me that SEO tool if it's not secret to see the format of the UI
kyl
kyl
16:43
this is good but is there any way to add resizable (columns) feature to existing code?
I have code like <table>.....</table>
17:42
nope
(to the previous question)
 
2 hours later…
19:45
@ndugger i.imgur.com/HSCg3G7.png Come, my friends. The ROs are going to war. It is likely that we go to our doom. The last march of the ROs.
3
Nice
That's a lot of comments
Just remember that I'm innocent
20:05
!!jb ndugger
fail
20:28
should make failures return a png of the fail json
I could do that
20:54
guys i'm getting the request is not allowed by the user agent or the platform in the current context in mac while the same api is working in windows
where
@rlemon make me an RO
so I can watch the ndugger discussions
user8729657
But ndugger is a good guy!
00:00 - 21:0021:00 - 00:00

« first day (3240 days earlier)      last day (1933 days later) »