mozilla :: #mdn

12 Sep 2017
11:41sheppyYawn. It's early. :)
15:17sheppystandups: Posted to Discourse a proposal to rename the pages in the HTML element reference and to open discussion about determining how we can make use of the term "tag", which our guidelines currently recommend against. https://discourse.mozilla.org/t/proposal-changing-the-titles-of-html-element-reference-pages/19112
15:17standupsOk, submitted #50816 for https://www.standu.ps/user/sheppy/
16:23sheppystandups: Replied to John's point on the thread about the HTML element page names with more info about that and some related stuff.
16:23standupsOk, submitted #50819 for https://www.standu.ps/user/sheppy/
16:49Tonnesgrrreetings.. I've been struggling a bit with a support question (https://support.mozilla.org/questions/1175052) regarding extensions.autoDisableScopes. It's solved, but made me wonder if it would make sense to include the MDN quote in my last post to the MDN doc the user linked to in his forst post. Can anyone check and consider in some free time?
16:59wbamberghey Tonnes, Id say: please go ahead and add this if you think it makes sense.
16:59wbambergdo we have a style guide for JS examples on MDN?
17:00wbambergI did find this: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Guidelines/Code_samples#JavaScript but it is quite limited
17:05Tonneswbamberg: thanks.. Of course I'm willing to, but am afraid to mess things up a bit (w regard to paragraphs and such), and others may know better where to put it. Can you or anyone else do?
17:05TonnesCome to think of it, it may also be sufficient to add a link to the "Changes in directory structure" section in the other doc around the pref mentioned.
17:06TonnesI tend to limit my en-US contributions to grammar issues ;)
17:06wbambergYes, I think your suggestion about adding a link is a good one
17:08wbambergI know very little about this (configuring Firefox for the enterprise), you probably know better than me, which is why I suggested you should make the change. I can review it if that would make you feel more comfortable :)
17:19Tonneswbamberg: well I'm not very familiar with enterprise configs either :) .. But.. I had a look and think this needs more changes, i.e. https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Alternative_distribution_options/Add-ons_in_the_enterprise#Settings_scope_preferences_programmatically refers to (Firefox install)\defaults\pref, and this is what doesn't work for extensions.autoDisableScopes
17:19Tonnes(it does however for extensions.enabledScopes)..
17:19Tonneswould it be possible to let rebloor make the required changes?
17:20Tonnesas he wrote the original content and may know best
17:22wbambergrebloor was a contractor whos now finished
17:22wbambergmkaply knows a lot about this stuff IIRC
17:29sheppyYep
17:56Tonnesthat's for sure.. perhaps i should email him?
18:53wbambergTonnes, sorry, I had to go out. Its best to file a bug: https://bugzilla.mozilla.org/enter_bug.cgi?product=Developer%20Documentation, then we can triage it properly.
18:55Tonneswbamberg: will do tonight/tomorrow, but have to go out now. Thanks!
19:01Tonneswbamberg: (probably missed message) will do tonight/tomorrow, but have to go out now. Thanks!
19:50sheppystandups: Filed bug 1399233 pointing out that it's a little weird that the "Bookmarks" menu item opens a window named "Library".
19:50standupsOk, submitted #50829 for https://www.standu.ps/user/sheppy/
19:50firebothttps://bugzil.la/1399233 NEW, nobody@mozilla.org The menu item "Bookmarks" opens a window named "Library" - what?
19:56sheppystandups: Finally conceded defeat on attempts to get used to the Page Action menu's submenu not automatically opening on hover, and went to file a bug. Found bug 1390551 already.
19:56standupsOk, submitted #50830 for https://www.standu.ps/user/sheppy/
19:56firebothttps://bugzil.la/1390551 NEW, nobody@mozilla.org Photon submenus don't expand on hover
21:10PaulHarrishaving some issues with the extra credit portion of the filling in a guest list portion of this active exercise
21:10PaulHarrishttps://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Looping_code
21:10PaulHarrisi can get the loop to work
21:10PaulHarrisand i think i'm actually replacing/slicing the text at the end of the string
21:10PaulHarrisbut i don't know how to replace the current string with the changed versions
21:10PaulHarrishttps://i.imgur.com/pe5vbe8.png is what i have
21:16araiPaulHarris: you're doing "Active learning: Filling in a guest list" section, right?
21:16PaulHarrisarai: yeah
21:16PaulHarrisi get the loop portion
21:17PaulHarrishttps://i.imgur.com/27cJh4o.png i feel like this is somewhat closer
21:17PaulHarrisi'm pretty sure if i could do a console(log) for admit2 and refused2 it'd show portion of the string i changed
21:17PaulHarrisbut i don't know how to get that back onto the original string
21:18araiwhat do you mean by original string?
21:18PaulHarrisadmitted and refused
21:18PaulHarrisi thought it was appending the people variable to the string named admitted or refused and then stopping once the loop was complete
21:21araiadmitted and refused are not string
21:21araithe content of admitted.textContent is string
21:21araiso, you can get and set value from/to it
21:22araiwhen whenever you expect string, you need to write "admitted.textContent"
21:22araiinstead of "admitted" only
21:23arais/when //
21:23PaulHarrisoh
21:23PaulHarrislet me try that
21:23araithen, assigning a value to it changes the value
21:23araiyou don't have to declare extra variable
21:23araibut just assign to it
21:24PaulHarrisbut i can't do admitted.textContent.slice can i?
21:25araiyou cannot?
21:25araido you get any error?
21:26araiI think you can
21:27PaulHarrisi don't know because i can't use the console on this exercise to my knowledge
21:29araiyou can use console
21:29araiconsole.log works and also error is also logged
21:31PaulHarrisoic
21:31PaulHarrisi'll try that
21:38PaulHarrisarai: oh it does say undefined
21:38PaulHarrisinterestind
21:39araiwhat does?
21:43PaulHarriswhen i set admit2 and refused2
21:43PaulHarrisin the do while loop
21:43PaulHarristhey show as undefined in the console.log
21:44araican you paste the code to http://pastebin.mozilla.org/ ?
21:48PaulHarrisarai: yeah
21:48PaulHarrishttps://pastebin.mozilla.org/9032261 this is what i have now
21:49PaulHarrisi tried doing the string methods outside of the do while loop and now it's telling me admitted isn't a function
21:49araiyou need ".textContent"
21:50araialso, slice and replace doesn't change the called value itself, but returns substring or replaced string
21:52araislice and replace are method of string, and admitted and refused are *not* string
21:55PaulHarrishttps://i.imgur.com/5rkuotv.png https://pastebin.mozilla.org/9032263 so this is closer to what i thought was happening earlier
21:55PaulHarrisreplace is actually replacing lola now
21:56araiyes, it returns the replaced value
21:56araibut "redused.textContent" itself is not changed by the call
21:57PaulHarristhat's waht i thought
21:58araiso if you want the value to be changed, you need to assign new value to it
22:02PaulHarrishttps://pastebin.mozilla.org/9032264 now it looks like i'm in the same spot
22:02araiactually, you can assign to refused.textContent
22:03araias you already did it in line 6
22:06PaulHarrishey that one actually worked
22:08PaulHarrishttps://pastebin.mozilla.org/9032265 arai so this one works
22:09PaulHarrisfinally
22:09PaulHarrisbut i have another question
22:09arai:)
22:09PaulHarrisalso thank you
22:09PaulHarrisi always get confused as to when and where i have to call stuff again
22:10arai"again" ?
22:10PaulHarrisyeah
22:10araido you mean when to call function?
22:11araican you describe more?
22:11PaulHarrisyes whenever i manipulate a string basically
22:12PaulHarrisi understood how to used .replace or .slice but i never knew how to get them on the original string essentially
22:12araistring functions doesn't change the called value
22:13araiso, if variable X contains "abc", X.replace("a", "A") returns "Abc", but the value of X remains "abc"
22:14araiif you want X to be "Abc", you need to assign the returned value of replace to it
22:14araiso, X = X.replace("a", "A")
22:14araithat way, the content of variable X *changes*
22:15PaulHarrisoic
22:16PaulHarrisso it'd be on line 1 x = 'stuff' and then on line two x = x.replace('ff,"yy");
22:16araiyes
22:17PaulHarrisalso
22:17PaulHarrismy solution to this problem basically required me to already know what the strings looked like after they were sorted
22:17araiyeah
22:18PaulHarrisis there a way to do it
22:18PaulHarriswithout knowing that
22:18araibut actually, you don't need to include "Bruce" or "Lola" in the arguments of replace
22:18PaulHarrisif i did replace(',','.') i thought i'd do all the periods and commas
22:19PaulHarrisor rather just not the last one like i wanted
22:19araithe first one, not all
22:19PaulHarrisfor instnace var admitted2 = admitted.textContent.replace(',','.'); does the first one
22:19PaulHarrisbut i want the last one
22:19araiso, yes, just removing the name doesn't work
22:19PaulHarrisand i don't know how long the list would be
22:19PaulHarrismaybe that's why they were using slice
22:20araithis helps https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
22:20araiyou can specify "the last comma" with it
22:20PaulHarrisin the replace method?
22:20araiyes
22:20arai /, $/
22:20PaulHarrisoh interesting
22:20araiit means, "comma and space at the end of input string"
22:22PaulHarrislearned a lot more than i thought i would
22:23PaulHarristhat's why i keep hearing why regex is so useful
22:23araiyeah, it's very powerful
13 Sep 2017
No messages
   
Last message: 8 days and 5 hours ago