Hegwin.Me
Thoughts grows up by feeding itself with its own words.
Home
Tools
WoW Battle Pet
Meow Etymons
About
Notes about Observer APIs in JavaScript
JavaScript 中的 Observer API
JavaScript
Sep 17, 2023
Recently, I need to implement a feature in a web page. The background is like this, we have a navigation bar at the top of the page that slides left and right, when the user scrolls down the page, we will add a class named active to the corresponding item in the navigation bar, when this active item is not...
Learn New Features in ES 2015 Part 4
学习ES2015 Part 4
JavaScript
ES2015
Aug 18, 2016
## New Features of Object ## Shorthand syntax ES2015 has such a syntactic sugar that when a new Object is generated, it can have a shorthand when the key name is the same as the variable name. See the following example for exactly how to write it. In the past, we needed to write it like this: ```js function buildUser(first,...
Learn New Features in ES 2015 Part 3
学习ES2015 Part 3
JavaScript
ES2015
Aug 17, 2016
## New Features of Array ## Array Destructing It feels like a way to learn from Ruby or similar languages. In ES5, we didn't have a way to directly assign individual values of an array to multiple variables at once, but now we can, assuming we have such an array: ```js let users = [ 'Hegwin', 'Jason', 'Ken' ]; ```...
Learn New Features in ES 2015 Part 2
学习ES2015 Part 2
JavaScript
ES2015
Aug 16, 2016
# String ES2015 has added the concept of Template String, so we don't need to keep using `+` when we want to stitch variable values into the middle of a string, which is what I think we can cheer about. This is how it works: the normal string in JS is still surrounded by single or double quotes, but the...
Learn New Features in ES 2015 Part 1
学习ES2015 Part 1
JavaScript
ES2015
Aug 12, 2016
## Variable declaration ## Declaring variables with `let` * Finally, no more `var` hoisting problem, you can declare block-level variables now (cheers) * Solve the problem of variable leakage in for loops. * Variables declared by `let` in the same block can be reassigned, but declaring variables with the same name again will throw an exception TypeError ## Declare variables...
Some Notes about Highcharts
关于Highcharts
JavaScript
Jan 12, 2016
I have tried two JS libraries for drawing graphics using HTML SVG - C3.js and Highcharts - but compared to the two, I personally feel that C3 is more difficult to use and requires a lot of parameters: the advantage is that I can control a lot of things myself, but the disadvantage is that development is very slow and...
Differrent behavior of new Date between Firefox and Chrome
new Date()在Firefox和Chome下不同效果
JavaScript
Apr 14, 2015
I've been working on a project where I need to draw charts, and the JS library I'm using is D3js. I've encountered an amazing problem where the points and lines that show up in Chrome don't show up in Firefox. Initially, I looked at the reason and found that the point coordinates were calculated differently. Our X-axis is the time...
How to handle javascript confirm with selennium webdriver
Selenium driver 对 JS Confirm 的处理
JavaScript
Selenium
Ruby
Jul 21, 2014
JS popup confirmation box is often used in web development, how does the feature test script handle this popup box? page.driver.browser.switch_to.alert.accept # => click OK page.driver.browser.switch_to.alert.dismiss # => click Cancel page.driver.browser.switch_to.alert.text #=> return popup text
Manipulate DOM with jQuery
jQuery对DOM的基本操作
jQuery
JavaScript
Apr 15, 2013
I have been using jQuery in my projects since two or three years ago, but I have never studied it carefully, basically searching the web and copying and pasting other people's code. Recently, I learned a little bit about jQuery's selectors and DOM operations at CodeSchool (which has since been renamed Pluralsight), and I think it's pretty useful to take...