Skip to content

Commit 067c211

Browse files
committed
Merge pull request #18 from everettcaleb/jqonsel-snippet
Added a new snippets (jqOff, jqOnSel, jsOffSel).
2 parents 8cfeb80 + 12c359f commit 067c211

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
3+
<CodeSnippet Format="1.5.0">
4+
<Header>
5+
<SnippetTypes>
6+
<SnippetType>Expansion</SnippetType>
7+
</SnippetTypes>
8+
<Title>jqOff</Title>
9+
<Author>Caleb Everett (github.com/everettcaleb)</Author>
10+
<Description>Detach an event handler from one or more events on the selected elements.</Description>
11+
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqOff</Shortcut>
13+
</Header>
14+
<Snippet>
15+
<Declarations>
16+
<Literal Editable="true">
17+
<ID>selector</ID>
18+
<ToolTip>Element(s) to bind to</ToolTip>
19+
<Default>selector</Default>
20+
<Function>
21+
</Function>
22+
</Literal>
23+
<Literal Editable="true">
24+
<ID>events</ID>
25+
<ToolTip>One or more space-separated event types or namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".</ToolTip>
26+
<Default>events</Default>
27+
<Function>
28+
</Function>
29+
</Literal>
30+
</Declarations>
31+
<Code Language="javascript"><![CDATA[$$($selector$).off($events$);]]></Code>
32+
</Snippet>
33+
</CodeSnippet>
34+
</CodeSnippets>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
3+
<CodeSnippet Format="1.5.0">
4+
<Header>
5+
<SnippetTypes>
6+
<SnippetType>Expansion</SnippetType>
7+
</SnippetTypes>
8+
<Title>jqOffSel</Title>
9+
<Author>Caleb Everett (github.com/everettcaleb)</Author>
10+
<Description>Detach an event handler from one or more events on the document with the specified selector.</Description>
11+
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqOffSel</Shortcut>
13+
</Header>
14+
<Snippet>
15+
<Declarations>
16+
<Literal Editable="true">
17+
<ID>selector</ID>
18+
<ToolTip>Element(s) to bind to</ToolTip>
19+
<Default>selector</Default>
20+
<Function>
21+
</Function>
22+
</Literal>
23+
<Literal Editable="true">
24+
<ID>events</ID>
25+
<ToolTip>One or more space-separated event types or namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".</ToolTip>
26+
<Default>events</Default>
27+
<Function>
28+
</Function>
29+
</Literal>
30+
</Declarations>
31+
<Code Language="javascript"><![CDATA[$$(document).off($events$, $selector$);]]></Code>
32+
</Snippet>
33+
</CodeSnippet>
34+
</CodeSnippets>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
3+
<CodeSnippet Format="1.5.0">
4+
<Header>
5+
<SnippetTypes>
6+
<SnippetType>Expansion</SnippetType>
7+
</SnippetTypes>
8+
<Title>jqOnSel</Title>
9+
<Author>Caleb Everett (github.com/everettcaleb)</Author>
10+
<Description>Attach an event handler function for one or more events to the document filtered by the selector.</Description>
11+
<HelpUrl>https://github.com/kspearrin/Visual-Studio-jQuery-Code-Snippets</HelpUrl>
12+
<Shortcut>jqOnSel</Shortcut>
13+
</Header>
14+
<Snippet>
15+
<Declarations>
16+
<Literal Editable="true">
17+
<ID>selector</ID>
18+
<ToolTip>Element(s) to bind to</ToolTip>
19+
<Default>selector</Default>
20+
<Function>
21+
</Function>
22+
</Literal>
23+
<Literal Editable="true">
24+
<ID>events</ID>
25+
<ToolTip>One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".</ToolTip>
26+
<Default>events</Default>
27+
<Function>
28+
</Function>
29+
</Literal>
30+
</Declarations>
31+
<Code Language="javascript"><![CDATA[$$(document).on($events$, $selector$, function () {
32+
$end$
33+
});]]></Code>
34+
</Snippet>
35+
</CodeSnippet>
36+
</CodeSnippets>

jQueryCodeSnippets/jQueryCodeSnippets.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@
455455
</Content>
456456
<Content Include="JavaScript\jQuery\jqSlideToggle.snippet" />
457457
<Content Include="JavaScript\jQuery\jqSlideToggleFull.snippet" />
458+
<Content Include="JavaScript\jQuery\jqOnSel.snippet" />
459+
<Content Include="JavaScript\jQuery\jqOff.snippet" />
460+
<Content Include="JavaScript\jQuery\jqOffSel.snippet" />
458461
<None Include="source.extension.vsixmanifest">
459462
<SubType>Designer</SubType>
460463
</None>

0 commit comments

Comments
 (0)