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

Added Support for Fragment Ids #27

Open
wants to merge 224 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
a9840d8
add support for fragment-ids specifying views or symbols
Mar 28, 2015
d728414
add example for symbol and view referencing via fragment-ids
Mar 28, 2015
541df26
update version number for bower
flobacher Mar 28, 2015
925c812
changed indentation
flobacher Mar 28, 2015
5966d86
add option, to only insert visible part specified via fragment-id of …
flobacher May 1, 2015
fd16ef5
enable default fallback for sprites referenced via fragment-id
flobacher May 1, 2015
2f35d0e
extend fragment-id example by a spritesheet generated with grunt-svg-…
flobacher May 1, 2015
b37313e
if view displays a use tag, the referenced symbol is injected
flobacher May 1, 2015
fecb5a7
update fragment-id example
flobacher May 1, 2015
e80cbdd
queryselector is used to speed up finding of the svg shape inside the…
flobacher May 1, 2015
1ce9a4a
style tags will be removed if special class is found on injection-tar…
flobacher May 7, 2015
588bac2
add editor-config
flobacher May 7, 2015
a6f31d2
add dist files
flobacher May 7, 2015
01e5a0c
cleanup, add drop_console to uglify options -> remove calls to consol…
May 7, 2015
5efa1de
png fallbacks work
May 11, 2015
1131a95
png-fallbacks
May 11, 2015
2229e36
provide array with fallback classnames that contain a replacement-char
May 12, 2015
3978592
bugfix fallback classname creation
May 12, 2015
fe09f74
bugfix fallback classname creation
May 12, 2015
34cb3ba
optimise classname creation
May 12, 2015
59c2c17
remove no-svg class from html element is svg is supported
May 12, 2015
55c6657
remove fallback classes on injection
May 12, 2015
d1c81ce
do not remove classnames if not there
flobacher May 21, 2015
eb0d92e
output correct logs
May 26, 2015
d9c017c
fix remove style tag from parent, which can be a <defs> as well as th…
May 26, 2015
9e7b071
update minified version
May 26, 2015
d317caa
add default icon class -> if inect-target has this class, all styles …
May 26, 2015
e38b86d
prefix styletags upon injection
flobacher May 27, 2015
5e277e4
do not write default removeStyleClass if it is specified in the options
May 27, 2015
1a3a7b0
edit fallback classnames list
flobacher May 28, 2015
d7893d4
add option to remove all style-tags upon injection
flobacher May 28, 2015
9198950
add option to keep inline-styles for some elems (specify via class) e…
flobacher May 28, 2015
b6693a4
Copy preserveAspectRatio of elem if exists
May 28, 2015
6f4863a
add possibility to add a common spritesheetURL for all svg instances
Jun 1, 2015
7c23f6e
optional prefix for fragIdClass assigned upon injection
flobacher Jun 2, 2015
d68f27f
version bump
flobacher Jun 2, 2015
15e1754
prefix all attributes that reference an id from defs
Jun 8, 2015
2b31cb7
unify id-prefixing
flobacher Jun 9, 2015
0b67cff
cleanup logs
flobacher Jun 9, 2015
b9c3944
version bump
Jun 9, 2015
99ed486
1.2.2
Jun 10, 2015
70b802e
change the default classnames that should be removed upon injection, …
Jun 10, 2015
06e6dfd
refactor to use an oop approach
Jun 10, 2015
4be677c
cleanup the oop approach
flobacher Jun 12, 2015
543fc97
add angular suport
flobacher Jun 13, 2015
3d91982
add angular suport 2
flobacher Jun 13, 2015
f1aa85b
refactor angular support
flobacher Jun 15, 2015
1d1a757
simplify build-setup
Jun 15, 2015
73e1ed3
simplify build-setup
Jun 15, 2015
1529207
2.0.2
Jun 15, 2015
9f959a3
2.0.2
Jun 15, 2015
d660786
replace angular.value by provider
Jun 15, 2015
861ed83
change name
Jun 15, 2015
2067b0c
bug fix: find symbol by view box returned more than one symbol
flobacher Jun 18, 2015
dc90149
Updated CHANGELOG
flobacher Jun 18, 2015
6766656
bugfix
flobacher Jun 18, 2015
eb677a0
2.0.5
flobacher Jun 18, 2015
623b590
bugfix
flobacher Jun 18, 2015
f25e199
2.0.6
flobacher Jun 18, 2015
5dd714b
enable use of data-src in combination with spritesheet
Jul 9, 2015
82d7c05
2.0.7
Jul 9, 2015
35d29ae
Updated CHANGELOG
Jul 9, 2015
990f631
fix indentations
Jul 9, 2015
4203538
fix indentations
Jul 9, 2015
c08fe76
improve support for combining single svgs with a spritesheet
Jul 9, 2015
c8bd742
remove console-logs
Jul 9, 2015
37aca0a
2.0.8
Jul 9, 2015
2dfc3e6
start prefixing of style-blocks if injected svg is not a spritesheet
flobacher Jul 10, 2015
64b1a8d
prefix style-blocks if injected svg is not a spritesheet
flobacher Jul 14, 2015
2255226
2.0.9
flobacher Jul 14, 2015
72e5a02
abort injection if no sprite-- class and no data-src found
flobacher Jul 28, 2015
768c624
remove unused variable
flobacher Jul 28, 2015
d29eb5b
wrap angular directive into $observe so injection will trigger even i…
flobacher Jul 28, 2015
05f6d56
2.0.10
flobacher Jul 28, 2015
a0c06d9
Updated CHANGELOG
flobacher Jul 28, 2015
29f99e2
bugfix angular directive
flobacher Jul 28, 2015
3e86de1
2.0.11
flobacher Jul 28, 2015
e562641
Updated CHANGELOG
flobacher Jul 28, 2015
d2eb782
fixed bug to work with multiple spritemaps
hochitom Mar 1, 2016
ee04dc3
Merge pull request #1 from hochitom/hochitom-patch-1
hochitom Mar 1, 2016
0b91e02
Merge pull request #1 from hochitom/master
flobacher Mar 1, 2016
a5ee0c8
2.0.12
flobacher Mar 1, 2016
8281b74
additional iri references are matched
flobacher Mar 1, 2016
8612dea
build scripts updated
flobacher Mar 1, 2016
5164dea
2.0.13
flobacher Mar 1, 2016
e44352e
build scripts updated
flobacher Mar 1, 2016
a5bc1b3
remove deprecated version from bower
flobacher Mar 2, 2016
303c20c
update dependency
flobacher Mar 2, 2016
990d68d
rearange npm scripts for better readability
flobacher Mar 2, 2016
507212f
ignore tests and examples when installed via nom
flobacher Mar 20, 2016
e9ef3ed
cleanup logs
flobacher Mar 20, 2016
ffc0ad2
elements can also be referenced via xlink:href.. need to suffix them …
flobacher Mar 20, 2016
eccb575
fix: previous version added suffix multiple times
flobacher Mar 21, 2016
f189ab4
elements can also be referenced via xlink:href. this time it works
Mar 21, 2016
571dec2
add support for IE
Mar 21, 2016
7c25536
2.0.14
flobacher Mar 21, 2016
ef029f2
add support to set title for accessibility
Mar 21, 2016
359a256
add support for the desc element and add the role="presentation" to a…
Mar 22, 2016
9d91dc3
update gitignore
flobacher Mar 22, 2016
fc29aea
2.0.15
flobacher Mar 22, 2016
6292886
update repo url and scripts
flobacher Mar 22, 2016
5e7774e
2.0.16
flobacher Mar 22, 2016
49cceae
update repo url and scripts
flobacher Mar 22, 2016
41f86cc
update scripts
flobacher Mar 22, 2016
c39a16f
2.0.17
flobacher Mar 22, 2016
52f5fe4
2.0.18
flobacher Mar 22, 2016
da5f9e4
cleanup
flobacher Mar 22, 2016
045205b
2.0.19
flobacher Mar 22, 2016
cfa5475
update scripts
flobacher Mar 22, 2016
c508c18
2.0.20
flobacher Mar 22, 2016
4f2317e
update readme
flobacher Mar 22, 2016
33afd04
2.0.21
flobacher Mar 22, 2016
84fd93c
update ignore rules
flobacher Mar 22, 2016
8453317
2.0.22
flobacher Mar 22, 2016
66f4ede
use .trim() only if element has a class attribute
hochitom Mar 22, 2016
ec44146
IE does not support Children on SVGElement!
Mar 22, 2016
ff5578d
${npm_package_version}
Mar 22, 2016
e425f4e
avoid latedef warnings
Mar 22, 2016
216993c
2.0.23
Mar 22, 2016
d945474
make npm scripts work on windows as well
Mar 22, 2016
9480d16
codestyle
Mar 22, 2016
a721de4
make npm scripts work on windows as well
Mar 22, 2016
5b5b00a
make npm scripts work on windows as well
Mar 22, 2016
7ae93d3
add shortcut script
Mar 22, 2016
dec40de
2.0.24
Mar 22, 2016
4ce5a2b
Merge branch 'master' of https://github.com/hochitom/SVGInjector2 int…
Mar 22, 2016
b59d1d8
Merge branch 'hochitom-master'
Mar 22, 2016
94916ed
2.0.25
Mar 22, 2016
8310c96
add accessibility section
Mar 22, 2016
07217d8
codestyle
Mar 22, 2016
9487319
2.0.26
Mar 22, 2016
f8cf0fe
added support for aria-hidden attribute on svg element
dgoerdes Mar 31, 2016
018127d
Merge pull request #3 from dgoerdes/master
flobacher Mar 31, 2016
bd6213b
update/move examples
flobacher Apr 3, 2016
bc9aab5
update scripts
flobacher Apr 3, 2016
d01d011
suffix id-references in style-tags and refactor
flobacher Apr 3, 2016
24e397d
do not add role=presentation to title and desc
flobacher Apr 3, 2016
aadf829
correct those id-refs in sample sprite sheet.. this needs fixing in i…
flobacher Apr 3, 2016
2cb030f
2.0.27
flobacher Apr 3, 2016
168c99d
respect aria-hidden also on injected sag
flobacher Apr 4, 2016
f16c19a
2.0.28
flobacher Apr 4, 2016
5da3c45
reorganise folder-structure, update examples and copy all attributes …
flobacher Feb 13, 2017
cadac66
fix package-scripts
Feb 13, 2017
e6c040f
update examples
Feb 13, 2017
3cd8015
update README
Feb 13, 2017
7a39a24
Update broken examples/spritesheet link
Feb 16, 2017
8a22972
Merge pull request #7 from TheCopartnery/patch-1
flobacher Feb 17, 2017
1aac685
fix fallbacks
flobacher Feb 20, 2017
58f4acd
do not remove console.logs
flobacher Feb 20, 2017
b1ccb91
update examples
flobacher Feb 20, 2017
c5e6c81
fix package scripts
flobacher Feb 20, 2017
95bfd75
2.0.29
flobacher Feb 20, 2017
60b98b1
fix package script
flobacher Feb 20, 2017
41f49c8
fix main entry in package.json
flobacher Feb 21, 2017
759c681
2.0.30
flobacher Feb 21, 2017
febe4b2
update links
Feb 22, 2017
ed77d43
Merge pull request #10 from TheCopartnery/patch-3
flobacher Feb 22, 2017
5803a9a
add copy command to stay compatible with file structure of version < …
flobacher Feb 22, 2017
fd897d7
codestyle: streamline folder-pathes
flobacher Feb 22, 2017
eb84ea3
make sure script works on all platforms
flobacher Feb 22, 2017
dd3f7d0
add copy of file to stay compatible with file structure of version < …
flobacher Feb 22, 2017
f19994c
fix main entry in bower.json
flobacher Feb 22, 2017
0c64792
v2.0.31
flobacher Feb 22, 2017
50eaafb
always set data-src even if only src was specified
flobacher Feb 22, 2017
794d4f5
add a basic, non-spritesheet example
flobacher Feb 22, 2017
d534db0
2.0.32
flobacher Feb 22, 2017
69ecf67
update/streamline examples and read
flobacher Feb 23, 2017
caedbeb
Add simple with img tag example
Feb 24, 2017
00838d8
Update README.md
Feb 24, 2017
35a3f6a
update README.md
flobacher Feb 27, 2017
9a951f4
Merge pull request #13 from TheCopartnery/master
flobacher Feb 27, 2017
3c85037
Merge pull request #14 from TheCopartnery/patch-4
flobacher Feb 27, 2017
2658876
add options
flobacher Feb 27, 2017
147b953
add options
flobacher Feb 27, 2017
85086e0
do not change src
flobacher Feb 27, 2017
73c3432
2.0.33
flobacher Feb 27, 2017
3e72195
Check for imgUrl - inline svg’s will not have an imgUrl (src/data-src…
Mar 1, 2017
a188971
spelling correction
Mar 1, 2017
a1cb4db
Merge pull request #16 from TheCopartnery/master
flobacher Mar 4, 2017
ba2226f
remove console.logs in minified version
flobacher Mar 5, 2017
3aef12b
add inline svgs to examples
flobacher Mar 5, 2017
3c4ba0e
exit, when neither src, data-src, nor sprite sheet url are specified
flobacher Mar 5, 2017
a0459c8
getter for config
flobacher Mar 5, 2017
7eab253
codestyle
flobacher Mar 5, 2017
215638d
only execute angular-directive code if src, data-src or sprite-class …
flobacher Mar 5, 2017
1de9aa8
adapt example
flobacher Mar 5, 2017
b1a17fc
add example for interpolation support of classnames
flobacher Mar 5, 2017
dedbd9b
start adding support for interpolated data-src
flobacher Mar 5, 2017
699af49
codestyle
flobacher Mar 5, 2017
80f8b04
2.0.34
flobacher Mar 5, 2017
9c09103
fix package-script
flobacher Mar 5, 2017
6e7f25f
angular-directive: allow sprite-id class to be not the first in the c…
flobacher Mar 13, 2017
7897ca7
update example
flobacher Mar 13, 2017
9b0617f
2.0.35
flobacher Mar 13, 2017
9517d99
update version nr. on build
flobacher Mar 28, 2017
9cb552c
2.0.36
flobacher Mar 28, 2017
9f81e08
bugfix, replace element
sladiri May 12, 2017
d11d9ba
Merge pull request #22 from sladiri/patch-1
flobacher May 12, 2017
e4d6f1a
2.0.37
May 12, 2017
de4a372
add the option to provide fallback svgs for fragment ids, that might …
May 12, 2017
54fa00d
2.1.0
May 12, 2017
6221b19
add width and height also on single elements (not spritesheet-fragmen…
May 15, 2017
013bb9d
codestyle
May 15, 2017
ba82a4c
2.1.1
May 15, 2017
c934bd3
chore: update for usage with node 8
Oct 9, 2017
aafb1fe
npm 5 support. hurray =)
Oct 9, 2017
4f71cc4
add `h1` to titles to identify them easier
Oct 9, 2017
fc49c49
add angular example
Oct 9, 2017
6eab4d9
update logic for title and desc creation/adaption
Oct 9, 2017
bd18b74
update examples to test new `title`, `desc`, `aria-labelledby` and `a…
Oct 9, 2017
6de7b44
make the `update-version-comment` script work on windows as well
Oct 9, 2017
01e4044
2.1.2
Oct 9, 2017
7b60c1f
get rid of `engines` field
Oct 9, 2017
1c7d9ca
2.1.3
Oct 9, 2017
a1c5b79
replace `yarn.lock` by `package-lock.json`
Oct 9, 2017
9345475
fix onDoneCallback for empty array
pga78 Oct 25, 2021
d1de008
mind if onDoneCallback defined
pga78 Oct 25, 2021
3c6d868
Merge pull request #29 from pga78/master
flobacher Nov 30, 2021
73e5a69
2.1.4
flobacher Nov 30, 2021
324d99d
update scripts
flobacher Nov 30, 2021
6a9cda1
document scripts
flobacher Nov 30, 2021
330b01b
fix update version script
flobacher Nov 30, 2021
8c3d59a
update dependency
flobacher Nov 30, 2021
2717a72
2.1.5
flobacher Nov 30, 2021
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
Prev Previous commit
Next Next commit
unify id-prefixing
flobacher committed Jun 9, 2015
commit 2b31cb75295982b4ae6864db25adabc86e7063e8
2 changes: 1 addition & 1 deletion dist/svg-injector.map.js
2 changes: 1 addition & 1 deletion dist/svg-injector.min.js
28 changes: 19 additions & 9 deletions svg-injector.js
Original file line number Diff line number Diff line change
@@ -133,18 +133,26 @@
}

function prefixIdReferences(svg, suffix) {
var attributes = ['fill', 'clip-path', 'mask', 'filter'];
// toCamelCase

forEach.call(attributes, function(attribute, idx, attrs) {
var curAttrCamel = toCamelCase(attribute);
console.log(curAttrCamel);
var definitions = svg.querySelectorAll(curAttrCamel + '[id]');
var newName;
//var attributes = [{attr:'fill', defs:}, 'clip-path', 'mask', 'filter'];
var defs = [
{def:'linearGradient', attr:'fill'},
{def:'radialGradient', attr:'fill'},
{def:'clipPath', attr:'clip-path'},
{def:'mask', attr:'mask'},
{def:'filter', attr:'filter'}
];
var def, attribute, newName;
forEach.call(defs, function(elem) {
def = elem.def;
attribute = elem.attr;
console.log(attribute + ':' + def);
var definitions = svg.querySelectorAll(def + '[id]');
for (var g = 0, defLen = definitions.length; g < defLen; g++) {
newName = definitions[g].id + '-' + suffix;
console.log('new name: ' + newName);
// :NOTE: using a substring match attr selector here to deal with IE "adding extra quotes in url() attrs"
var usingElements = svg.querySelectorAll('['+attribute+'*="' + definitions[g].id + '"]');
console.log(usingElements);
for (var h = 0, usingElementsLen = usingElements.length; h < usingElementsLen; h++) {
usingElements[h].setAttribute(attribute, 'url(#' + newName + ')');
}
@@ -567,6 +575,7 @@
svg.setAttribute('preserveAspectRatio', presARAttr);
}

/*
// Make sure any internally referenced clipPath ids and their
// clip-path references are unique.
//
@@ -601,7 +610,8 @@
}
masks[i].id = newMaskName;
}

*/
// suffix the masks, gradients, clipPaths and
prefixIdReferences(svg, injectCount);