Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(jquery): syntax highlight for JS #28

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ja/jQuery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jQueryプラグインはprototype拡張のように `$.fn.greenify = function ()

`jQuery.fn`の実装を見てみると、実態は`jQuery.prototype`であるため実際にprototype拡張していることがわかります。

```
```js
// https://github.com/jquery/jquery/blob/2.1.4/src/core.js#L39
jQuery.fn = jQuery.prototype = {
// prototypeの実装
Expand All @@ -31,7 +31,7 @@ jQuery.fn = jQuery.prototype = {

`$()`は内部的に`new`をしてjQueryオブジェクトを返すので、このjQueryオブジェクトではprototypeに拡張したメソッドが利用できます。

```
```js
$(document.body); // 返り値はjQueryのインスタンス
```

Expand Down Expand Up @@ -65,7 +65,7 @@ jQueryではそこをどうやってカバーしているかというと、

`$.fn`と同様に`prototype`へのaliasを貼っているだけのただのコンストラクタ関数です。

```
```js
calculator.fn = calculator.prototype;
```

Expand Down